How To Open A Custom File Extension as .txt Using Python
<p>I'm making a code that will create a new form of file extension (in this case .aobj, which will be used to help me make games easier).  I tried using the code below (this is using Python)</p>

<pre><code>print "Starting..."
info = []
part1 = open('temporary.aobj', 'r')
part2 = part1.readlines()
for line in part2:
   info.append(line)
print info
</code></pre>

<p>Instead of this printing out what's actually in the file when i used notepad, it shows this:</p>

<pre><code>Starting...
[[...], [...], [...]]
</code></pre>

<p>I'm guessing this is because it doesn't recognize the file format, but how can i fix this? </p>

<p>I was experimenting and found out that it would allow you to read the format properly as long as you wrote the info using python's write() function.  As so:</p>

<pre><code>file = open('temporary.aobj', 'r+')
file.write('foo')
info = file.readlines()
lines = []
for line in info:
   lines.append(line)
print lines
</code></pre>

<p>This will print out the info that is inside of it, it's slightly slower because you are required to write all the info using python.</p>

python file