Fastest way to loop through each digit in a number?

Dieter Buys dieter.buys at gmail.com
Mon Sep 6 09:51:36 CEST 2004


n2 = n
while n2 > 0:
    d = n2 % 10
    n2 /= 10
    foo(d)



More information about the Python-list mailing list