How do I write the magic function below?
magic
>>> num = 123 >>> lst = magic(num) >>> >>> print lst, type(lst) [1,
You could do this:
>>> num = 123 >>> lst = map(int, str(num)) >>> lst, type(lst) ([1, 2, 3], )