"culpritNr1" <ig2ar-s...@yahoo.co.uk> wrote

Say I have this nice list of lists:

LoL = [['chrX', '160944034', '160944035', 'gnfX.145.788', '63.60'],
['chrX', '161109992', '161109993', 'rs13484104', '63.60'],

Now I want to cast the second and third "columns" from string to integer,
like this

LoL = [['chrX', 160944034, 160944035, 'gnfX.145.788', '63.60'],
            ['chrX', 161109992, 161109993, 'rs13484104', '63.60'],

Being picky that's not really casting that's converting.
Casting is where you take the same set of binary data and treat it
as if it were a different type but without changing the binary.
Conversion is where you actually change the data into a new
representation. Conversion is relatively easy in Python, casting
is a bit more tricky.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to