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'>

Thanks

Owain Clarke wrote:
Please excuse the obviousness of my question (if it is), but I have searched the documentation for how to generate a list e.g. [(1,2), (3,4)] from a string "[(1,2), (3,4)]". I wonder if someone could point me in the right direction.

Many thanks

Owain Clarke

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to