“.flatten () python” Respostas de código

Lista de achaten Python

def flatten(L):
    for item in L:
        try:
            yield from flatten(item)
        except TypeError:
            yield item

list(flatten([[[1, 2, 3], [4, 5]], 6]))
>>>[1, 2, 3, 4, 5, 6]
Grieving Grivet

.flatten () python

>>> a = np.array([[1,2], [3,4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten('F')
array([1, 3, 2, 4])
Awful Albatross

Respostas semelhantes a “.flatten () python”

Perguntas semelhantes a “.flatten () python”

Mais respostas relacionadas para “.flatten () python” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código