Update deep_flatten.md

This commit is contained in:
Trupil
2020-12-29 23:23:45 +05:30
committed by GitHub
parent 260718bb3d
commit 93e0450af2

View File

@ -10,6 +10,8 @@ Deep flattens a list.
- If it is iterable, apply `deep_flatten()` recursively, otherwise return `[lst]`.
```py
from collections.abc import Iterable
def deep_flatten(lst):
return ([a for i in lst for a in
deep_flatten(i)] if isinstance(lst, Iterable) else [lst])