Fastest way to loop through each digit in a number?

Paul Rubin http
Mon Sep 6 05:27:18 CEST 2004

Rune Strand <rst at> writes:
You could try timing something like

  while n:
    n,d = divmod(n, 10)

That processes the digits in reverse order, of course.

More information about the Python-list mailing list