码迷,mamicode.com
首页 > 移动开发 > 详细

Python List append()方法

时间:2016-05-13 23:22:15      阅读:359      评论:0      收藏:0      [点我收藏+]

标签:

描述

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

语法

append()方法语法:

list.append(obj)

  

参数

  • obj -- 添加到列表末尾的对象。

返回值

该方法无返回值,但是会修改原来的列表。

实例

以下实例展示了 append()函数的使用方法:

#!/usr/bin/python

aList = [123, ‘xyz‘, ‘zara‘, ‘abc‘];
aList.append( 2009 );
print "Updated List : ", aList;

  

以上实例输出结果如下:

Updated List :  [123, ‘xyz‘, ‘zara‘, ‘abc‘, 2009]

  

Python List append()方法

标签:

原文地址:http://www.cnblogs.com/wushuaishuai/p/5491445.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!