How to convert strings into integers in python?
Posted
by elfuego1
on Stack Overflow
See other posts from Stack Overflow
or by elfuego1
Published on 2009-03-13T10:53:59Z
Indexed on
2010/04/23
0:33 UTC
Read the original article
Hit count: 722
Hello there,
I have a tuple of tuples from MySQL query like this:
T1 = (('13', '17', '18', '21', '32'),
('07', '11', '13', '14', '28'),
('01', '05', '06', '08', '15', '16'))
I'd like to convert all the string elements into integers and put it back nicely to list of lists this time:
T2 = [[13, 17, 18, 21, 32], [7, 11, 13, 14, 28], [1, 5, 6, 8, 15, 16]]
I tried to achieve it with "eval" but didn't get any decent result yet.
© Stack Overflow or respective owner