Re: [Tutor] Using read() before closing a file

2009-05-05 Thread Alan Gauld
"Eduardo Vieira" wrote arq = open('c:/myscripts/simple2.ttt', 'w') arq.write('The length is %d' % len(a)) res = arq.read() print res The print doesn't print the text I had written, That's because of two things: a) You opened the file for write only not reading b) You had moved the file curs

[Tutor] Using read() before closing a file

2009-05-05 Thread Eduardo Vieira
Hello, I found interesting today, as I was playing with this code in the shell: >>> arq = open('c:/myscripts/simple2.ttt', 'w') >>> len(a) 9 >>> arq.write('The length is %d' % len(a)) >>> res = arq.read() >>> print res The print doesn't print the text I had written, but some thing else I c