Python ProgrammingPython Programming

How to access an item from list in Python?

To access any list item you need to refer it by it's index number.

The following program shows how to fetch list items:

testList = ["Canada", "Japan", "London"]
print(testList[0])
print(testList[1])
print(testList[2])
Output
Canada
Japan
London