Python Dodaj element do tablicy
my_list = []
my_list.append(12)
Gentle Gazelle
my_list = []
my_list.append(12)
data = []
data.append("Item")
print(data)
theArray = []
theArray.append(0)
print(theArray) # [0]
theArray.append(1)
print(theArray) # [0, 1]
theArray.append(4)
print(theArray) # [0, 1, 4]
a = [1, 2, 3]
b = [10, 20]
a.append(b) # Output: [1, 2, 3, [10, 20]]
a.extend(b) # Output: [1, 2, 3, 10, 20]
capitals = ['A', 'B', 'C']
lowers = ['a', 'b', 'c']
alphabets = capitals + lowers
a = [1, 2, 3]
b = [10, 20]
a = a + b # Create a new list a+b and assign back to a.
print a
# [1, 2, 3, 10, 20]
# Equivalently:
a = [1, 2, 3]
b = [10, 20]
a += b
print a
# [1, 2, 3, 10, 20]