Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add element to list python at index


>>>
>>> a = [1, 2, 4]
>>> print a
[1, 2, 4]
>>> b = a[:2] + [3] + a[2:]
>>> print a
[1, 2, 4]
>>> print b
[1, 2, 3, 4]

Source by w3programmers.org #
 
PREVIOUS NEXT
Tagged: #add #element #list #python #index
ADD COMMENT
Topic
Name
7+2 =