split integer python code example
Example 1: split numbers python
num = 12345
>>> [int(i) for i in str(num)]
[1, 2, 3, 4, 5]
Example 2: split string and convert to int python
a, b = tuple(int(x) for x in '1 2'.split())
num = 12345
>>> [int(i) for i in str(num)]
[1, 2, 3, 4, 5]
a, b = tuple(int(x) for x in '1 2'.split())