How to convert string to list without eval or exec

Oliver Kurz olku at web.de
Tue Mar 9 08:51:17 CET 2004


Hello,

could someone give me a solution how to convert a string to a list without using eval or exec?

The string looks like:

'[["abc","abc",["abc","abc"],"abc"],["abc","abc",["abc","abc"],["abc",["abc","abc"]],"abc"],"abc"]'

and should be converted to a list:

[['abc', 'abc', ['abc', 'abc'], 'abc'], ['abc', 'abc', ['abc', 'abc'], ['abc', ['abc', 'abc']], 'abc'], 'abc']

I'm not allowed to use eval or exec.

-- 
--
Oliver Kurz





More information about the Python-list mailing list