Built-in Functions and Types
list()
Build a mutable ordered sequence by consuming an iterable. Calling without an argument gives an empty list. Construction from an existing list copies the outer container, not objects stored inside it. A mapping supplies keys; text supplies individual code points. A non-iterable raises TypeError.
Formal Syntax & Structure
python syntaxpython
list(iterable=(), /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| iterable | iterable | Source of elements; omit for an empty list. |
Return Value
list
A mutable sequence containing the yielded objects in iteration order.
Working Example
Example Snippetpython
original = [[1], [2]]copy = list(original)copy.append([3])print(original)print(copy)