A problem with list

Jeff Shannon jeff at ccvcorp.com
Mon Dec 13 12:23:32 EST 2004


gawel wrote:

> export at hope.cz wrote:
>
>> but when I have Mylist in a file and I read it from the file it does
>> not work as I expect.
>
>
> That's quite simple. Your file contain a string, not a list
> You must use eval(your_list_as_string).


...except that eval() is a huge security hole.  A better bet would be to 
use either the listquote module mentioned elsewhere, or to find an 
alternative way of storing your data that *doesn't* require using eval() 
to read it back in from disk.  One possibility would be the ConfigParser 
module, which makes it easy to store (and retrieve) information from 
.ini-style files and/or the Windows Registry.

Jeff Shannon
Technician/Programmer
Credit International




More information about the Python-list mailing list