[Tutor] string to list

Stefan Behnel stefan_ml at behnel.de
Wed Feb 10 13:44:10 CET 2010


Owain Clarke, 10.02.2010 13:34:
> I have solved it myself - must search more before posting!
> 
> If anyone at my kind of level is interested:-
> 
>>>> mystring = "[(1,2), (3,4)]"
>>>> mylist = eval(mystring)
>>>> mylist
> [(1,2), (3,4)]
>>>> type(mylist)
> <type 'list'>

As others have pointed out, this may or may not solve your problem, and it
may introduce other problems, such as security vulnerabilities.

Stefan



More information about the Tutor mailing list