Copyright © tutorialspoint.com
This method inserts object obj into list at offset index.
list.insert(index, obj) |
Here is the detail of parameters:
index: Index where the object obj need to be inserted.
obj: Object to be inserted into the given list
It returns none but it inserts the given element at the given index.
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc']; print "Final List : ", aList.insert( 3, 2009); |
This will produce following result:
Final List : [123, 'xyz', 'zara', 2009, 'abc'] |
Copyright © tutorialspoint.com