[int(i) for i in str(number)]或者,如果不想使用列表推导,或者您想使用不同于10的底数from __future__ import division # for compatibility of // between Python 2 and 3def digits(number, base=10): assert number >= 0 if number == 0: return [0] l = [] while number > 0: l.append(number % base) number = number // base return l