STRING TO LIST

Adam Hupp hupp at cs.wisc.edu
Tue Apr 8 14:14:22 EDT 2003


On Tue, Apr 08, 2003 at 02:56:08PM -0300, jubafre at brturbo.com wrote:
> Hello, 
> 
> I need to change a variable from string to list. 
> > 
> > >>> x=str("[[12,13],[14,15]]") 
> > >>> x 
> > '[[12,13],[14,15]]' 

>>> b = eval("[[12,13],[14,15]]")
>>> type(b)
<type 'list'>
>>> b
[[12, 13], [14, 15]]

 
-Adam





More information about the Python-list mailing list