假设你需要给列表添加一个元素的话,可以用,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)]
转载地址:
阅读(1218) | 评论(0) | 转发(0) |