Hick Hick - 15 days ago 7
Python Question

Splitting integer in Python?

My integer input is suppose

12345
, I want to split and put it into an array as
1, 2, 3, 4, 5
. How will I be able to do it?

luc luc
Answer
>>> [int(i) for i in str(12345)]

[1, 2, 3, 4, 5]
Comments