python list append 相关知识点

假设你需要给列表添加一个元素的话,可以用list的append方法,append()方法接受的参数可以是任意的数据,比如,string,list,tuple等

a = '111'

b = [1,2,3]

c = (1,2,3)

cinfo = [44,55,66]

cinfo.append(a)
cinfo.append(b)
cinfo.append(c)
print cinfo

结果是:[44, 55, 66, '111', [1, 2, 3], (1, 2, 3)]

原文地址:https://www.cnblogs.com/wanpython/p/3001981.html