Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

append python


list1 = ["One", "value"]

list1.append("to add") # "to add" can also be an int, a foat or whatever"

# list is now ["One", "value","to add"]

#Or

list2 = ["One", "value"]
# "to add" can be any type but IT MUST be in a list
list2 += ["to add"] # can be seen as list2 = list2 + ["to add"]

# list2 is now ["One", "value", "to add"]
# but it have been reconstructed so no side-effects on copied lists will occure
 
PREVIOUS NEXT
Tagged: #append #python
ADD COMMENT
Topic
Name
3+8 =