On 02/10/14 16:47, John Doe wrote:
def loop_extract():
with open('words.txt', 'r') as f:
for lines in f:
#print lines (I confirmed that each line is successfully printed)
with open('export.txt', 'w') as outf:
This opens and closes the file for each iteration of the inner loop.
You need this outside the loop beside the other with statement.
outf.write(lines)
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor