How to extract digit from a number?

fl rxjwg98 at gmail.com
Mon Jul 21 22:14:18 CEST 2014


Hi,

I see the following example on line, but it does not work. I do not know what is
wrong. Could you correct it for me?


Thanks,



........................
I'm not sure what [1, 1, 0, 0, 0, 0, ...] has to do with 128, but if you want the 
base 10 digits:

>>> a = 1234
>>> [int(d) for d in str(a)]
>>> [1, 2, 3, 4]



More information about the Python-list mailing list