Deep flatten list
Deep flattens a list.
- Use recursion.
- Use
isinstance()
withcollections.abc.Iterable
to check if an element is iterable. - If it is iterable, apply
deep_flatten()
recursively, otherwise return[lst]
.
Deep flattens a list.
isinstance()
with collections.abc.Iterable
to check if an element is iterable.deep_flatten()
recursively, otherwise return [lst]
.