How to update value of list item in python?
To update the value of a specific item, need to refer it by it's index number.
The following program shows how to update value of list items:
testList = ["Canada", "Japan", "London"] print(testList) testList[0] = "Germany" testList[1] = 100 print(testList)
Output
['Canada', 'Japan', 'London'] ['Germany', 100, 'London']