append item to python list code example
Example 1: add something to list python
lst = [1, 2, 3]
something = 4
lst.append(something)
Example 2: add item to list python
list.append(item)
Example 3: how to add item to a list python
my_list = []
item1 = "test1"
my_list.append(item1)
print(my_list)
Example 4: append python
List = ["One", "value"]
List.append("to add")
List2 = ["One", "value"]
List2 += ["to add"]
Example 5: append to lists python
list = ['a', 'b', 'c', 'd']
print list[1:-1]
list[0:2] = 'z'
print list