get a list from a string

simon kagwe simonkagwe at yahoo.com
Thu Jun 7 06:34:24 EDT 2007


Hi,

I have a string "distances = [[1,1,1,1],[2,2,2,2]]". I want to create a
variable called distances whose value is the list [[1,1,1,1],[2,2,2,2]]. How can
I go about that? I know I can use setattr, but how do I create the list from the
string?

Regards,
Simon




More information about the Python-list mailing list