Python list() Function
Example
Create a list containing fruit names:
x =
list(('apple', 'banana', 'cherry'))
Try it Yourself »
Definition and Usage
The list()
function creates a list object.
A list object is a collection which is ordered and changeable.
Read more about list in the chapter: Python Lists.
Syntax
list(iterable)
Parameter Values
Parameter | Description |
---|---|
iterable | Required. A sequence, collection or an iterator object |