Python list() Function

Example

Create a list containing fruit names:

x = list(('apple', 'banana', 'cherry'))

Running Example

Definition and Usage

The list() function creates a list object.

List objects are ordered and mutable collections.

Learn more about lists in this chapter: Python Lists.

Syntax

list(iterable)

Parameter Values

Parameters Description
iterable Required. A sequence, set, or iterator object.