u3
This commit is contained in:
parent
f85b9aa778
commit
f1eae5140a
@ -0,0 +1,15 @@
|
|||||||
|
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
|
||||||
Loading…
Reference in New Issue
Block a user