Re: Safe eval, or how to get list from string

2005-05-16 Thread Edvard Majakari
[EMAIL PROTECTED] writes: > I've to use ConfigParser. > > It returns values that are exactly in the config file, so get string > variables like: > int1 with quotes and characers: "42" > this is easy to convert to int: > realint = int(int1) There's already a method getint() for that, you can just

Re: Safe eval, or how to get list from string

2005-05-15 Thread Steven Bethard
Joseph Garvin wrote: > [EMAIL PROTECTED] wrote: > >>It has something called "reval" looks that would fit my needs >>perfectly. >> >>Details: >>http://www.faqts.com/knowledge_base/view.phtml/aid/4550/fid/538 > > If I remember correctly reval and it's brothers were deemed insecure, > are no longer

Re: Safe eval, or how to get list from string

2005-05-15 Thread Joseph Garvin
[EMAIL PROTECTED] wrote: >>http://twistedmatrix.com/users/moshez/unrepr.py >>http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 >> >> > >Thanks, this helps - but I was looking at using no additional modules, >or using something that came bundled in with python 2.3 > >I just discove

Re: Safe eval, or how to get list from string

2005-05-13 Thread bwooster47
> http://twistedmatrix.com/users/moshez/unrepr.py > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469 Thanks, this helps - but I was looking at using no additional modules, or using something that came bundled in with python 2.3 I just discovered mx.Tools.NewBuiltins It has somethin

Re: Safe eval, or how to get list from string

2005-05-13 Thread Michael Spencer
[EMAIL PROTECTED] wrote: > I've to use ConfigParser. > > It returns values that are exactly in the config file, so get string > variables like: > int1 with quotes and characers: "42" > this is easy to convert to int: > realint = int(int1) > > I've read the tutorial, and the FAQ, and not sure if I

Re: Safe eval, or how to get list from string

2005-05-13 Thread Jason Mobarak
[EMAIL PROTECTED] 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 u

Safe eval, or how to get list from string

2005-05-13 Thread bwooster47
I've to use ConfigParser. It returns values that are exactly in the config file, so get string variables like: int1 with quotes and characers: "42" this is easy to convert to int: realint = int(int1) I've read the tutorial, and the FAQ, and not sure if I missed it, but other than calling eval (wh