I want to divide number into digits and save them in list (or array) in python. So firstly I should create list like
dig = [0 for i in range(10)]
and then
i = 0
while num > 9:
dig[i] = num % 10
i += 1
num /= 10
dig[i] = num
But I don't really like just creating list for 10 spaces, is it possible to get length of number without repeating loop
i = 0
num2 = num
while num2 > 9:
num2 /= 10
i += 1
i += 1
and then repeat first part of code? Or just make as I made in first place? I don't know exact length of number but it won't be very long
So any advices? Maybe you know better way to divide numbers into digits, or maybe something else.