温馨提示×

python中append函数怎么用

九三
480
2021-01-28 15:47:00
栏目: 编程语言

python中append函数怎么用

在python中使用append函数的方法

append:append()函数的作用是用于在列表末尾添加新的对象。

append()函数语法:

list.append(obj)

参数:

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

append()函数使用方法:

aList = [123, 'xyz', 'zara', 'abc'];

aList.append( 2009 );

print "Updated List : ", aList;

输出结果为:

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

0