“Como não usar uma lista em Python” Respostas de código

python como desnecessar uma lista aninhada

# Basic syntax:
unnested_list = list(chain(*nested_list))
# Where chain comes from the itertools package and is useful for 
#	unnesting any iterables

# Example usage:
from itertools import chain
nested_list = [[1,2], [3,4]]
my_unnested_list = list(chain(*nested_list))
print(my_unnested_list)
--> [1, 2, 3, 4]
Charles-Alexandre Roy

Como não usar uma lista em Python

a_list=["hello","there","little","kid",":)"]
not_a_list=" ".join(a_list)
print(not_a_list)
#==> "hello there little kid :)"
Shiny Seal

Respostas semelhantes a “Como não usar uma lista em Python”

Perguntas semelhantes a “Como não usar uma lista em Python”

Procure respostas de código populares por idioma

Procurar outros idiomas de código