Is there a simple way to parse this string ?
josepharmbruster at gmail.com
josepharmbruster at gmail.com
Wed Dec 19 16:51:13 EST 2007
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 <stef.mien... at gmail.com> 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 need it in the future: even deeper nested
> lists, represented by a string.)
>
> thanks,
> Stef Mientki
More information about the Python-list
mailing list