Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python list insert() method is used to add an element at specified index of the list.

Syntax

list.insert(idx, elem)

Parameters

idx Required. index number at which the element need to be inserted in the list.
elem Required. value of the element which need to be inserted in the list.

Return Value

None.

Example:

In the below example, list insert() method is used to insert element called 'APR' at index = 3 in the list called MyList

month = ['JAN', 'FEB', 'MAR', 'MAY']
# add 'APR' at index=3
month.insert(3,'APR') 
print(month)

The output of the above code will be:

['JAN', 'FEB', 'MAR', 'APR', 'MAY']

❮ Python List Methods