Python List append()方法

append() 方法用于在列表末尾添加新的对象。
Grammar:
 1 list.append(obj) 
参数
obj -- 添加到列表末尾的对象。
返回值
该方法无返回值,但是会修改原来的列表。
Case:

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

 

 

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

posted on 2017-11-17 11:25  sub2020  阅读(100)  评论(0)    收藏  举报

导航