| Store | Cart

How to convert string to list without eval or exec

From: DomF <fid...@clara#spam#.co.uk>
Wed, 10 Mar 2004 12:02:55 -0000
"William Park" <opengeometry at yahoo.ca> wrote in message
news:c2kt5q$1uonf0$2 at ID-99293.news.uni-berlin.de...
> Oliver Kurz <olku at web.de> wrote:> > 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.>> - write to a file> - load the file as module :-)

This made me laugh out loud after reading all the heavy duty parsing
options, is that bad?

Dom

>> -- > William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>> Linux solution for data processing and document management.

Recent Messages in this Thread
Paul McGuire Mar 09, 2004 09:16 am
Peter Otten Mar 09, 2004 09:54 am
William Park Mar 09, 2004 04:59 pm
DomF Mar 10, 2004 12:02 pm
Peter Otten Mar 10, 2004 12:57 pm
Peter Harris Mar 11, 2004 10:28 pm
Messages in this thread

Next post: Gadfly ????