I have a list called ilist which looks like this:
['TCS', 1968, ['Mumbai', 'Delhi', 'Kochi', 'Banglore', 'Pune'], 'Wipro', 1981, ['Pune', 'Banagalore', 'Pune']]
Now I want to insert some additional values in a form of list something like highlighted one below:
['TCS', 1968, ['Mumbai', 'Delhi', 'Kochi', 'Banglore',**["ITPL","Whiteflied"]**, 'Pune'], 'Wipro', 1981, ['Pune', 'Banagalore', 'Pune']]
I thought to try the insert method, which I was able to use to insert 2nd nested loop like this:
ilist.insert(2,['Mumbai','Delhi','Kochi','Banglore','Pune'])
But as the insert method take only one argument, i.e the index where we want to insert the value. How we can give it like below:
ilist.insert(2,3,"ITPL","Vedhi","Electronic city")
this is giving error. Which I know will always come:
Traceback (most recent call last):
File "G:/Python Programs/Loops.py", line 41, in <module>
ilist.insert(2,3,"ITPL","Vedhi","Electronic city")
TypeError: insert() takes exactly 2 arguments (5 given)
So what is the alternative method I can use to achieve the same? Apart from declaring a fresh list.