测试代码
list1 = []
list2 = []
a =[1,2,3]
b = [4,5,6]
list1.extend(a)
list1.extend(b)
list2.append(a)
list2.append(b)
print('list1:',list1)
print('list2:',list2)
结果
list1: [1, 2, 3, 4, 5, 6]
list2: [[1, 2, 3], [4, 5, 6]]
测试代码
list1 = []
list2 = []
a =[1,2,3]
b = [4,5,6]
list1.extend(a)
list1.extend(b)
list2.append(a)
list2.append(b)
print('list1:',list1)
print('list2:',list2)
结果
list1: [1, 2, 3, 4, 5, 6]
list2: [[1, 2, 3], [4, 5, 6]]