Fastest way to loop through each digit in a number?

Dieter Buys dieter.buys at gmail.com
Mon Sep 6 03:51:36 EDT 2004


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



More information about the Python-list mailing list