[Tutor] Writing dictionaries to a file
rabidpoobear at gmail.com
Mon Apr 7 19:16:33 CEST 2008
Jerrold Prothero wrote:
> I've been trying to understand how writing a dictionary to a file &
> it back should work.
> Here are three guesses at how to call writerows, with error traces.
> Traceback (most recent call last):
> File "<pyshell#13>", line 1, in <module>
> File "C:\Python25\lib\csv.py", line 129, in writerows
> File "C:\Python25\lib\csv.py", line 118, in _dict_to_list
> for k in rowdict.keys():
> AttributeError: 'str' object has no attribute 'keys'
This error sounds like d is a string, not a dictionary. Are you sure
it's a dictionary?
More information about the Tutor