“Como remover os últimos 2 elementos da lista em Python” Respostas de código

Como remover os últimos 2 elementos da lista em Python

l = list(range(1,5))
l = test_list[: len(test_list) - 2] 
Annoying Aardvark

Exclua os últimos itens de uma lista python

# Remove the last 3 items from a list
x = [1, 2, 3, 4, 5]
for i in range(3): x.pop()
Excited Earthworm

Respostas semelhantes a “Como remover os últimos 2 elementos da lista em Python”

Perguntas semelhantes a “Como remover os últimos 2 elementos da lista em Python”

Procure respostas de código populares por idioma

Procurar outros idiomas de código