Python List append()方法

append() 方法用于在列表末尾添加新的对象。
Grammar:

list.append(obj)

参数
obj — 添加到列表末尾的对象。
返回值
该方法无返回值,但是会修改原来的列表。
Case:

1 alist=[123,'abc'];
2 alist.append(2020);
3 print "new list : ",alist;

Output:

 1 new list : [123, 'abc', 2020] 

quote:http://www.runoob.com/python/att-list-append.html

posted on 2017-11-18 10:30  sub2020  阅读(340)  评论(0编辑  收藏  举报

导航