Python 的 list.append(~) 方法将一个项目添加到列表的末尾。
参数
1.x | any type
要添加到列表末尾的项目。
返回值
None
例子
基本用法
要将 'green' 添加到列表 colors 的末尾:
colors = ['red', 'blue']
colors.append('green')
print(colors)
['red', 'blue', 'green']
相关用法
- Python List append()用法及代码示例
 - Python List remove()用法及代码示例
 - Python List insert()用法及代码示例
 - Python List clear()用法及代码示例
 - Python List reverse()用法及代码示例
 - Python List copy方法用法及代码示例
 - Python List sort方法用法及代码示例
 - Python List extend方法用法及代码示例
 - Python List cmp()用法及代码示例
 - Python List remove方法用法及代码示例
 - Python List pop()用法及代码示例
 - Python List index()用法及代码示例
 - Python List sort()用法及代码示例
 - Python List pop方法用法及代码示例
 - Python List reverse方法用法及代码示例
 - Python List list()用法及代码示例
 - Python List max()用法及代码示例
 - Python List count()用法及代码示例
 - Python List insert方法用法及代码示例
 - Python List len()用法及代码示例
 - Python List count方法用法及代码示例
 - Python List min()用法及代码示例
 - Python List index方法用法及代码示例
 - Python List clear方法用法及代码示例
 - Python List copy()用法及代码示例
 
注:本文由纯净天空筛选整理自Isshin Inada大神的英文原创作品 Python List | append method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
