Chapters
Python114 chapters

ReferenceBuilt-in functions

list()

Turns any iterable into a list, and is the usual way to see an iterator.

Signature

list(iterable=())

Parameters

NameMeans
iterablewhat to copy from

Returns

A new list.

Example

Python
print(list("abc"))
print(list(range(4)))
print(list({"a": 1, "b": 2}))

Output

['a', 'b', 'c']
[0, 1, 2, 3]
['a', 'b']

See also