Tambahkan item ke array python
data = []
data.append("Item")
print(data)
Colorful Crane
data = []
data.append("Item")
print(data)
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]
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]