Skip to content

Instantly share code, notes, and snippets.

@molcay
Created December 20, 2016 19:36
Show Gist options
  • Select an option

  • Save molcay/6e9f0127ca63a1cb5bb185418c02f874 to your computer and use it in GitHub Desktop.

Select an option

Save molcay/6e9f0127ca63a1cb5bb185418c02f874 to your computer and use it in GitHub Desktop.
Iterate over list in Python
list_to_iter = [ ["a", "b"], ["c", "d"], ["e", "f"] ]
for item in list_to_iter:
print(item)
for i in range(len(list_to_iter)):
print(list_to_iter[i])
for (i, item) in enumerate(list_to_iter):
print(i, item)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment