STRING TO LIST

Terry Reedy tjreedy at udel.edu
Tue Apr 8 21:29:56 EDT 2003


<jubafre at brturbo.com> wrote in message
news:mailman.1049843053.19630.python-list at python.org...
> Hello,
>
> I need to change a variable from string to list.
> > >>> x=str("[[12,13],[14,15]]")
> > must be a list like this:
> > [[12, 13], [14, 15]]

>>> eval('[[12,13],[14,15]]' )
[[12, 13], [14, 15]]

Terry J. Reedy






More information about the Python-list mailing list