“Como exibir itens em uma lista em novas linhas Python” Respostas de código

Imprimir lista aninhada em novas linhas em Python

A = [[1, 2, 3], [2, 3, 4], [4, 5, 6]]
print("OUTPUT1: ")
[print(a) for a in A];
'''
OUTPUT1:
[1, 2, 3]
[2, 3, 4]
[4, 5, 6]
'''
# --------------------------------------------------------------
# if you don't want to see [] in the printout, then do
# [print(*a) for a in A];
A = [[1, 2, 3], [2, 3, 4], [4, 5, 6]]
print("\nOUTPUT2: ")
[print(*a) for a in A];
'''
OUTPUT2:
1 2 3
2 3 4
4 5 6
'''
Stentechy

Imprima cada elemento da lista na nova linha Python

mylist = ['10', '12', '14']
for elem in mylist:
        print elem 
CrossbowJeffery

Como exibir itens em uma lista em novas linhas Python

x = [1,2,3,4,5]
print('\n'.join(x))
dunk shot enthusiast

Respostas semelhantes a “Como exibir itens em uma lista em novas linhas Python”

Perguntas semelhantes a “Como exibir itens em uma lista em novas linhas Python”

Procure respostas de código populares por idioma

Procurar outros idiomas de código