[Tutor] Writing a list in a text file
Mihai Iacob
aymchaos at yahoo.com
Sun Dec 3 09:27:52 CET 2006
Hello
def saveBugs(data):
store = open(filename, 'w')
for timeMark,aList in data.items():
store.write(timeMark + '\n')
store.write(aList + '\n')
store.close()
data is a dictionary
aList is a list
After i run this part the following error pops up:
Traceback (most recent call last):
File "C:\Python\Bugs.py", line 133, in <module>
main()
File "C:\Python\Bugs.py", line 130, in main
saveBugs(dataBugs)
File "C:\Python\Bugs.py", line 17, in saveBugs
store.write(aList + '\n')
TypeError: can only concatenate list (not "str") to
list
Can anybody tell me how to make it work
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
More information about the Tutor
mailing list