Answers for "flattening list python"

2

python flatten list

itertools.chain.from_iterable(factors)
Posted by: Guest on October-20-2020
0

python flatten a list of lists

from collections.abc import Iterable

def flatten(l):
    for el in l:
        if isinstance(el, Iterable) and not isinstance(el, (str, bytes)):
            yield from flatten(el)
        else:
            yield el
Posted by: Guest on August-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language