List to STR to List
Larry
ld at nospam.com
Sun Jul 14 16:39:26 EDT 2002
More information about the Python-list mailing list
Sun Jul 14 16:39:26 EDT 2002
- Previous message (by thread): Python and Parrot
- Next message (by thread): List to STR to List
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Alex Martelli" <aleax at aleax.it> wrote in message news:2glY8.79177$vm5.2885629 at news2.tin.it... > Larry wrote: > > > I can convert a list to a string as follows: > > > > List1 = [1,2,3] > > String1 = str(L1) > > > > Is there now a way to convert my String1 variable back into a list??? > > There are several ways, but probably the most reasonable one is: > > import rexec > > alist = rexec.RExec().r_eval(String1) > > > All those 'r' stand for Restricted -- you want Restricted > execution (evaluation, in this case) to make sure no disaster > can happen, just in case the string may have been hacked > by some clever fellow. > > If you must perform many such evaluations, it's speedier to: > > > import rexec > > rr = rexec.RExec() > > alist1 = rr.r_eval(String1) > alist2 = rr.r_eval(String2) > alist3 = rr.r_eval(String3) > Thank you so much for the speedy response! Larry
- Previous message (by thread): Python and Parrot
- Next message (by thread): List to STR to List
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list