Peter, Thanks.

This recipe fails when negative numbers are used.

safe_eval('(12, -12)')
*** Unsafe_Source_Error: Line 1.  Unsupported source construct:
compiler.ast.UnarySub

But, I think it could  be easily fixed for somebody who understands the
script. Can somebody help.

Thanks.
Suresh
Peter Otten wrote:
> [EMAIL PROTECTED] wrote:
>
> >   I have a string '((1,2), (3,4))' and I want to convert this into a
> > python tuple of numbers. But I do not want to use eval() because I do
> > not want to execute any code in that string and limit it to list of
> > numbers.
> >   Is there any alternative way?
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/364469
> 
> Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to