Files
freeCodeCamp/guide/chinese/python/lists/list-append-method/index.md

27 lines
714 B
Markdown
Raw Normal View History

---
title: List Append Method
localeTitle: 列出追加方法
---
2018-10-19 22:58:49 -07:00
## 列表方法 - 增加新元素到列表
2018-10-19 22:58:49 -07:00
列表有很多方法您可以通过在python控制台中键入`help(list)`来探索所有这些方法。 其中之一是append函数正如名称所示其可以增加给定列表的参数。
#### 示例用法
```py
words = ["I", "love", "Python"]
words.append("very much")
print(words)
```
#### 产量
```
["I", "love", "Python", "very much"]
```
2018-10-19 22:58:49 -07:00
您可能已经注意到, 在执行append命令以后元素`"very much"`被加到了列表的末尾。
#### 更多信息:
2018-10-19 22:58:49 -07:00
`append()`的官方文档可以在[这里](https://docs.python.org/3.6/tutorial/datastructures.html)找到