Writing text file with python returns odd result?
<p>Ok, I am trying to simply learn reading and writing text files in python. I can read the file etc but I get unexpected results when I attempt to write the file using <code>write("my string")</code> and then go to execute my code the file gets wrote to but the first line that was wrote will not fully print out. This happens in Vim with pymode and from the command line as well as interpreter. Here is the code:</p>

<pre><code>#!/usr/bin/python

f = open('/Users/Desktop/data.txt', 'r+')

f.write("Test")


for lines in f:
    print lines

f.close()
</code></pre>

<p>Now when I execute this file to write to <code>data.txt</code> the output will look like this:</p>

<p>est  &lt;------ the "T" in Test is totally cut off. I hope this makes sense, Thanks in advance.</p>
