Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

insert an element in list python

>>> a = [1, 2, 4]
>>> print a
[1, 2, 4]

>>> print a.insert(2, 3)
None

>>> print a
[1, 2, 3, 4]

>>> b = a.insert(3, 6)
>>> print b
None

>>> print a
[1, 2, 3, 6, 4]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #insert #element #list #python
ADD COMMENT
Topic
Name
1+7 =