Merge pull request #420 from trupil3/master

Update deep_flatten.md
This commit is contained in:
Isabelle Viktoria Maciohsek
2020-12-29 20:16:14 +02:00
committed by GitHub

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])