Python list() 函数
定义和用法
list() 函数创建列表对象。
列表对象是有序可更改的集合。
参阅:Python 列表。
实例
创建包含水果名称的列表:
x = list(('apple', 'banana', 'cherry'))
语法
list(iterable)
参数
| 参数 | 描述 |
|---|---|
| iterable | 必需。序列、集合或迭代器对象。 |
list() 函数创建列表对象。
列表对象是有序可更改的集合。
参阅:Python 列表。
创建包含水果名称的列表:
x = list(('apple', 'banana', 'cherry'))
list(iterable)
| 参数 | 描述 |
|---|---|
| iterable | 必需。序列、集合或迭代器对象。 |