convert a string to tuple

bcannon at gmail.com bcannon at gmail.com
Tue May 31 16:46:14 EDT 2005


Pass it to eval:

>>> eval('(1, 2, 3, 4, 5)')
(1, 2, 3, 4, 5)

Basically what you are doing it evaluating the repr of the tuple.

-Brett




More information about the Python-list mailing list