names1=['Alice','Bob','Candy','David','Ellena']
names2=['Gen','Phoebe','Zero']
names1.append(names2)
print(names1)
这样输出结果是:
['Alice','Bob','Candy','David','Ellena',['Gen','Phoebe','Zero']]
怎么样可以去掉输出结果中的[]?
names1=['Alice','Bob','Candy','David','Ellena']
names2=['Gen','Phoebe','Zero']
for item in names2:
names1.append(item)
print(names1)
L1=['Alice', 'Bob', 'Candy', 'David', 'Ellena']
L2=[89,67,29,48,3]
n=1
for item in L2:
L1.insert(n,item)
n+=2
print(L1)
还可以错位插入