标签:style blog color 数据 div sp on c log
//定义一个列表list1 list1 = ["aaa","bbb","ccc","ddd"] //打印列表 print(list1) //向列表末尾添加数据,如下,list1结果为["aaa","bbb","ccc","ddd","eee"] list1.append("eee") //删除列表末尾数据,函数返回值为删除的最后一个数值,如下,list1结果为["aaa","bbb","ccc","ddd"] list1.pop() //向列表末尾增加数据项集合,如下,list1结果为["aaa","bbb","ccc","ddd","eee","ddd","fff"]
list1.extend(["ddd","fff"])
//删除列表中特定的数据项,如下,list1结果为["bbb","ccc","ddd","eee","ddd","fff"]
list1.remove("aaa")
//在列表中某指定位置前增加一数据项(注意是指定位置前),如下,list1的结果为["aaa","bbb","ccc","ddd","eee","fff"]
list1.insert(0,"aaa")
标签:style blog color 数据 div sp on c log
原文地址:http://www.cnblogs.com/johnny521/p/3991185.html