On 5 Nov 2006 04:34:32 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi,
> 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
> num
[EMAIL PROTECTED] skrev:
> Hi,
> I have a string '((1,2), (3,4))' and I want to convert this into a
> python tuple of numbers.
I think your question is deeper and more natural than is clear from the
many recepies given so far in this thread, so I'll take on another
point of view,
>From a langu
[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.
here's yet another approach:
http://online.effb
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> 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
[EMAIL PROTECTED] wrote:
> Hi,
> 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?
>
> Thanks
[EMAIL PROTECTED] wrote:
> 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.
I think that s
[EMAIL PROTECTED] wrote:
> Hi,
> 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?
This is
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 O
[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.ac
[EMAIL PROTECTED] wrote:
> Hi,
> 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?
Python
Hi,
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?
Thanks.
Suresh
--
http://mail.python.org/mai
11 matches
Mail list logo