cf.CfList.insert

CfList.insert(index, item)[source]

Insert an object before the given index in place.

Parameters :

index : int

item :

Returns :

None

Examples

>>> s
[1, 2, 3]
>>> s.insert(1, 'A')
>>> s
[1, 'A', 2, 3]
>>> s.insert(100, 'B')
[1, 'A', 2, 3, 'B']
>>> s.insert(100, 'B')
[1, 'A', 2, 3, 'B']
>>> s.insert(-2, 'C')
[1, 'A', 2, 'C', 3, 'B']
>>> s.insert(-100, 'D')
['D', 1, 'A', 2, 'C', 3, 'B']

Previous topic

cf.CfList.index

Next topic

cf.CfList.pop

This Page