有以下几种方法来添加元素到一个list中:
my_list = [1, 2, 3]
my_list.append(4)
print(my_list) # 输出 [1, 2, 3, 4]
my_list = [1, 2, 3]
my_list.insert(1, 5)
print(my_list) # 输出 [1, 5, 2, 3]
my_list = [1, 2, 3]
new_list = [4, 5, 6]
my_list.extend(new_list)
print(my_list) # 输出 [1, 2, 3, 4, 5, 6]
my_list = [1, 2, 3]
new_list = [4, 5, 6]
my_list += new_list
print(my_list) # 输出 [1, 2, 3, 4, 5, 6]