Re: Is there a simple way to parse this string ?

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 07:21:26 -0800, [EMAIL PROTECTED] wrote: > Steven D'Aprano, > > On Dec 21, 2:08 am, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: >> On Thu, 20 Dec 2007 20:27:23 -0800, [EMAIL PROTECTED] wrote: >> > Stef, >> >> > For clarification, there is nothing hazardous about using eval on

Re: Is there a simple way to parse this string ?

2007-12-22 Thread [EMAIL PROTECTED]
Steven D'Aprano, On Dec 21, 2:08 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 20 Dec 2007 20:27:23 -0800, [EMAIL PROTECTED] wrote: > > Stef, > > > For clarification, there is nothing hazardous about using eval on the > > string that you presented. > > > t = eval('(0, 0, 0, 255), (192,

Re: Is there a simple way to parse this string ?

2007-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2007 20:27:23 -0800, [EMAIL PROTECTED] wrote: > Stef, > > For clarification, there is nothing hazardous about using eval on the > string that you presented. > > t = eval('(0, 0, 0, 255), (192, 192, 192, 255), True, 8') > > Whether or not this is the "simplest" solution, remains a

Re: Is there a simple way to parse this string ?

2007-12-20 Thread [EMAIL PROTECTED]
Stef, For clarification, there is nothing hazardous about using eval on the string that you presented. t = eval('(0, 0, 0, 255), (192, 192, 192, 255), True, 8') Whether or not this is the "simplest" solution, remains a question. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simple way to parse this string ?

2007-12-20 Thread George Sakkis
On Dec 19, 8:44 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > I think the last thread of this nature also cited a similar tool by > the effbot, which he describes > here:http://www.effbot.org/zone/simple-iterator-parser.htm. > This parser is about 10X faster than the equivalent pyparsing parser.

Re: Is there a simple way to parse this string ?

2007-12-19 Thread Paul McGuire
On Dec 19, 4:23 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 20, 9:10 am, Larry Bates <[EMAIL PROTECTED]> wrote: > > In particular Paul Maguire recently pointed to a safe evaluator that > was restricted (IIRC) to something like lists/dicts/etc of ints/floats/ > string/etc constants -- looks

Re: Is there a simple way to parse this string ?

2007-12-19 Thread Paul McGuire
On Dec 19, 4:23 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 20, 9:10 am, Larry Bates <[EMAIL PROTECTED]> wrote: > > > > > > > Stef Mientki wrote: > > > hello, > > > > I need to translate the following string > > >a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' > > > > into the follo

Re: Is there a simple way to parse this string ?

2007-12-19 Thread Gabriel Genellina
En Wed, 19 Dec 2007 19:23:36 -0300, John Machin <[EMAIL PROTECTED]> escribió: > On Dec 20, 9:10 am, Larry Bates <[EMAIL PROTECTED]> wrote: >> Stef Mientki wrote: >> >> > I need to translate the following string >> >a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' >> >> > into the followin

Re: Is there a simple way to parse this string ?

2007-12-19 Thread John Machin
On Dec 20, 9:10 am, Larry Bates <[EMAIL PROTECTED]> wrote: > Stef Mientki wrote: > > hello, > > > I need to translate the following string > >a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' > > > into the following list or tuple > >b = [(0, 0, 0, 255), (192, 192, 192, 255), True, 8 ] >

Re: Is there a simple way to parse this string ?

2007-12-19 Thread Larry Bates
Stef Mientki wrote: > hello, > > I need to translate the following string >a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' > > into the following list or tuple >b = [(0, 0, 0, 255), (192, 192, 192, 255), True, 8 ] > > Is there a simple way to to this. > (Not needed now, but might nee

Re: Is there a simple way to parse this string ?

2007-12-19 Thread [EMAIL PROTECTED]
Stef, You can quickly get a tuple via: t = eval('(0, 0, 0, 255), (192, 192, 192, 255), True, 8') Joseph Armbruster On Dec 19, 4:17 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > hello, > > I need to translate the following string > a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' > > into

RE: Is there a simple way to parse this string ?

2007-12-19 Thread James Newton
>I need to translate the following string >a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' > >into the following list or tuple >b = [(0, 0, 0, 255), (192, 192, 192, 255), True, 8 ] >Is there a simple way to to this. >Stef Mientki >>> a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8

Is there a simple way to parse this string ?

2007-12-19 Thread Stef Mientki
hello, I need to translate the following string a = '(0, 0, 0, 255), (192, 192, 192, 255), True, 8' into the following list or tuple b = [(0, 0, 0, 255), (192, 192, 192, 255), True, 8 ] Is there a simple way to to this. (Not needed now, but might need it in the future: even deeper nested