Convert a string to a list

rh0dium steven.klass at
Tue Apr 24 16:59:20 CEST 2007

Hi all,

I am using pexpect to drive another tool.  Some of the data I get back
would be better suited as a list and I want to know a simple way to
parse the data to push it into a list.

For example

I get the following string back.  I want to convert this to a list:

'("." ".." "" ""

should be:
["." ".." "" ""

It should be able to handle embeded lists like this:
'("." ("" "") "" ""

should become
["." ["" ""] "" ""

Is there some exisitng code which will handle this task?

More information about the Python-list mailing list