>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'
>>> b = eval(a)
>>> b
((0, 0, 0, 255), (192, 192, 192, 255), True, 8)
>>> c = list(eval(a))
>>> c
[(0, 0, 0, 255), (192, 192, 192, 255), True, 8]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to