15 lines
271 B
Python
15 lines
271 B
Python
def flatten(iterable):
|
|
result = []
|
|
copy = list(iterable)
|
|
|
|
while copy:
|
|
|
|
item = copy.pop(0)
|
|
|
|
if isinstance(item,list):
|
|
copy = item + copy
|
|
|
|
elif item is not None:
|
|
result.append(item)
|
|
|
|
return result |