Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python añadir elementos a una lista

>>> lista_compra = ["huevos", "leche"]

# Añadir un elemento
>>> lista_compra.append("cereales")
>>> lista_compra
["huevos", "leche", "cereales"]

# Añadir varios elementos
>>> lista_extra = ["manzanas", "aguacate"]
>>> lista_compra.extend(lista_extra)
>>> lista_compra
["huevos", "leche", "cereales", "manzanas", "aguacate"]
Comment

PREVIOUS NEXT
Code Example
Python :: remove trailing and leading spaces in python 
Python :: connect to mysql database jupyter 
Python :: segregate list in even and odd numbers python 
Python :: mirror 2d numpy array 
Python :: colored text python 
Python :: object.image.url email template django 
Python :: how to create a file in a specific location in python 
Python :: python send email outlook 
Python :: pyspark min column 
Python :: how to sort values in numpy by one column 
Python :: type hint tuple 
Python :: python how to get alphabet 
Python :: telnet via jump host using python 
Python :: python global site packages 
Python :: python get square root 
Python :: flask migrate install 
Python :: tkinter hover button 
Python :: 1052 uri solution 
Python :: append to csv python 
Python :: python read arguments 
Python :: update python in miniconda 
Python :: remove after and before space python 
Python :: read binary file python 
Python :: matplotlib axes labels 
Python :: sqlalchemy datetime default now create table 
Python :: download kaggle dataset in colab 
Python :: python convert hex to binary 
Python :: nb_occurence in list python 
Python :: python version check 
Python :: logging the terminal output to a file 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =