How do I write the magic function below?
magic
>>> num = 123 >>> lst = magic(num) >>> >>> print lst, type(lst) [1, 2, 3], <type 'list'>
You mean this?
num = 1234 lst = [int(i) for i in str(num)]
1.4m articles
1.4m replys
5 comments
57.0k users