d=['Alice','Bob','Candy','David','Ellena']
l=['Gen','Phoebe','Zeo']
d.append(l)
print(d) ==>['Alice', 'Bob', 'Candy', 'David', 'Ellena', ['Gen', 'Phoebe', 'Zeo']]
用extend,extend是将两个list合并成一个list。append()是将你传入的参数看做一个元素,拼到 上一个list中
d=['Alice','Bob','Candy','David','Ellena']
l=['Gen','Phoebe','Zeo']
d.extend(l)
print(d)
d=['Alice','Bob','Candy','David','Ellena']
l=['Gen','Phoebe','Zeo']
for x in l:
d.append(x)
print(d)