Python Loop Through List Items


Loop Through List Items

You can loop through the list items by using a for loop:

Example

Print all items in the list, one by one:

thislist = ["apple", "banana", "cherry"]
for x in thislist:
  print(x)
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.