Jerrold Prothero wrote:
>  
> I've been trying to understand how writing a dictionary to a file & 
> reading
> it back should work.
>  [snip]
>  
> Here are three guesses at how to call writerows, with error traces.
>  [snip]
> 2)
>  
> w.writerows(d)
>  
> Traceback (most recent call last):
>   File "<pyshell#13>", line 1, in <module>
>     w.writerows(d)
>   File "C:\Python25\lib\csv.py", line 129, in writerows
>     rows.append(self._dict_to_list(rowdict))
>   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?
-Luke
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to