Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ultraflatten.py
- grid=[0, [1, 2], [3, 4, (5, 6,),(7, {8, 9})], 'abc']
- def onedee(array):
- result=[]
- def scan(array):
- for i in array:
- if isinstance(i, (int, str)):
- result.append(i)
- else: scan(i)
- scan(array)
- return result
- print onedee(grid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement