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

posted @ 2020-04-06 16:03  喜欢吃面的猪猪  阅读(327)  评论(0编辑  收藏  举报