Python List insert() Method

❮ List Methods


Example

Insert the value "orange" as the second element of the fruit list:

fruits = ['apple', 'banana', 'cherry']

fruits.insert(1, "orange")
Try it Yourself »

Definition and Usage

The insert() method inserts the specified value at the specified position.


Syntax

list.insert(pos, elmnt)

Parameter Values

Parameter Description
pos Required. A number specifying in which position to insert the value
elmnt Required. An element of any type (string, number, object etc.)

❮ List Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.