Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python append in specific position

# --> list.insert(position, element) <--

# List of string 
list1 = ['Hi' ,  'hello', 'at', 'this', 'there', 'from']

# Add an element at 3rd position in the list
list1.insert(3, 'why')
#-> ['Hi', 'hello', 'at', 'why', 'this', 'there', 'from']
 
PREVIOUS NEXT
Tagged: #python #append #specific #position
ADD COMMENT
Topic
Name
8+4 =