标签: python string loops
我在想它:
> %timeit sum([int(digit) for digit in str(n)]) 100000 loops, best of 3: 1.52 us per loop > %timeit sum(int(digit) for digit in str(n)) 100000 loops, best of 3: 2.04 us per loop