1、创建列表
newList = []
2、向列表增加元素
newList = []
newList.append("a,b,c,d,f")
print(newList)
得到结果
['a,b,c,d,f']
3、从列表中获取元素
newList = ["a","b","c","d","f"]
print(newList[2])
得到结果
c
4、列表分片
newList = ["a","b","c","d","f"]
print (newList[1:4] )
得到结果
['b', 'c', 'd']
5、修改元素
newList = ["a","b","c","d","f"]
newList[2] = 's'
print (newList)
得到结果
['a', 'b', 's', 'd', 'f']
6、向列表中增加函数的其它方法
(1)append()向列表末尾增加一个元素。
(2)extend() 向列表末