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 write("my string")
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:
#!/usr/bin/python
f = open('/Users/Desktop/data.txt', 'r+')
f.write("Test")
for lines in f:
print lines
f.close()
Now when I execute this file to write to data.txt
the output will look like this:
est <------ the "T" in Test is totally cut off. I hope this makes sense, Thanks in advance.