You can do this with a generator:
def split_number(number):
number_as_string = str(number)
for character in number_as_string:
if not character.isdigit():
continue
yield int(character)
import math
print(list(split_number(math.pi)))
# [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9]
Or if you prefer a one-liner:
list(int(character) for character in str(math.pi) if character.isdigit())
# or
[int(character) for character in str(math.pi) if character.isdigit()]
I believe these answers are preferable because of the use of isdigit
instead of special-casing only the .
character.