Safe eval, or how to get list from string
Jason Mobarak
jason.mobarak at gmail.com
Fri May 13 12:54:54 EDT 2005
bwooste... at gmail.com wrote:
> if there is list1 = "[ 'filea', 'fileb', ]", I can get at list by
> doing:
> reallist = eval(list1)
> is there an easier/simpler method of doing the same thing as
realstring
> and reallist lines above?
http://twistedmatrix.com/users/moshez/unrepr.py
Example:
>>> from unrepr import unrepr
>>> unrepr("[ 'filea', 'fileb', ]")
['filea', 'fileb']
More information about the Python-list
mailing list