Python Fails to Write to File
cutey Love
cuteywithlove at gmail.com
Wed Jun 18 19:03:43 EDT 2014
I'm trying to write data to a text file
But I'm getting the error:
TypeError: invalid file: <_io.TextIOWrapper
Code is
def saveFile():
file_path = filedialog.asksaveasfile(mode='w', filetypes=[('text files', '.txt')], defaultextension=".txt")
fo = open(file_path, 'w')
for e in myList:
fo.write(e)
fo.close()
The file is being created if not already present but no data is written
More information about the Python-list
mailing list