I want to write something in a file.
for example,
fo=open('C:\\Python\\readline_test.txt','a')
for i in range(3):
st='abc'+'\n'
fo.write(st)
fo.close
then I open this python file in IDLE, and click “Run Module”.
There is no error message but I find the writing is not complete if I didn’t quit IDLE.
How can I complete the file writing without quitting the IDLE?
Thanks.
(I use Python 2.6.2 on Windows XP.)
You can try using
and mayby
after writing to file object to ensure that all file operations are flushed to disk.