hello,

I need to parse a nested list, given as a string, like this

line = " A  [  B  [ C+2 ] + 3 ] "

( I probably can do it with find, but I guess that's not the most elegant way, besides recusrion is not my strongest point)

which should be parsed so I get an list from inner to outer side (don't know if these are the correct words),
but I should like to have a list or tuple for tis case:

parsed = [ C+2,  B[C+2]+3,   A  [  B  [ C+2 ] + 3 ] ]
  or (last term is not needed, as well as the constants aren't)
parsed = [ C,  B[C+2] ]

this all, to improve the improved error / exception message even more ;-)

thanks,
Stef




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to