string to integer problem

Lol McBride newspost at lolmc.com
Sun Feb 8 12:13:44 EST 2004


On Sun, 08 Feb 2004 18:00:11 +0100, Diez B. Roggisch wrote:

>> I'm currently having problems with data returned from a MySQL database in
>> as much as the data returned is of the form '(1,10,23,33,35,48)' i.e. a
>> list variable holding 6 integers returned as a string.
> 
>>>> s = '(1,10,23,33,35,48)'
>>>> t = eval(s)
>>>> print t
> (1,10,23,33,35,48)
Hi,
thanks for this it worked a treat but I don't understand how - even after
reading the docs for the eval() builtin function.Could you explain what's
going on (in fairly simple terms as well - I'm a programmer for fun not
cause it's my job)
Thank you,
Lol



More information about the Python-list mailing list