[Tutor] Re: Nested Lists / Array Module

Andrei project5 at redrival.net
Tue Oct 21 20:33:27 EDT 2003


Harm_Kirchhoff at mail.digital.co.jp wrote:
> Python supports nested lists, which is very nice and can be used for very 
> simple databases.
> 
> However, I could not find a way to write nested lists to files & retrieve 
> them easily.
> The .writelines() method expects a string as an argument.
> 
> Is there a method to dump any list on disk & read it back, or is it 
> necessary to code this task ?

Not too long ago a similar question (or was it the same?) was on the list
I believe. You can either pickle or convert your list to a string using 
str(),
e.g. str(MyList). It doesn't matter how deep that list is.

<snip>

-- 
Yours,

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V 
ernq gur yvfg, fb gurer'f ab arrq gb PP.





More information about the Tutor mailing list