Skip to content

Home

Digitize number

Converts a number to a list of digits.

def digitize(n):
  return list(map(int, str(n)))

digitize(123) # [1, 2, 3]

More like this

Start typing a keyphrase to see matching snippets.