python 列表的append()和extend()
append():
a = [1, 2, 3]
b = ['戴口罩', 2020, '四月']
c = a.append(b)
print('a:', a)
print('c:', c)
输出结果:
a: [1, 2, 3, ['戴口罩', 2020, '四月']]
c: None
extend():
aa = [1, 2, 3]
bb = ['戴口罩', 2020, '四月']
cc = aa.append(bb)
print('aa:', aa)
print('cc:', cc)
输出结果:
aa: [1, 2, 3, ['戴口罩', 2020, '四月']]
cc: None
欢迎指错。 Thanks!