Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l2 = [[[[[[1,2,3,4,5]]]]]]
- def flatten_list(li):
- x = li[0]
- if isinstance(x, list):
- return flatten_list(x)
- else:
- return li
- print(flatten_list(l2)) #[1, 2, 3, 4, 5]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement