[Tutor] a string of nested-list to a list?

Francois Granger francois.granger@free.fr
Thu Mar 27 10:33:02 2003


At 14:43 +0000 27/03/2003, in message [Tutor] a string of nested-list 
to a list?, pan wrote:
>Any eazy way to convert a string of nested-list into a list?
>
>An example:
>
>target = '[[a,b], [[c,d],e]]]'
>result = [ ['a','b'], [['c','d'], 'e'] ]

>>>  a = "[['a','b'],[['c','d'],'e']]"
>>>  b = eval(a)
>>>  b
[['a', 'b'], [['c', 'd'], 'e']]
>>>  b[1]
[['c', 'd'], 'e']
>>>

-- 
Hofstadter's Law :
It always takes longer than you expect, even when you take into 
account Hofstadter's Law.