Skip to content

Instantly share code, notes, and snippets.

@pavdmyt
Created October 29, 2015 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavdmyt/4aaf8eeb64d78dd6a9ff to your computer and use it in GitHub Desktop.
Save pavdmyt/4aaf8eeb64d78dd6a9ff to your computer and use it in GitHub Desktop.
Iterate over a list of tuples, ignore all but the last item in each tuple.
tuples = [(1, 2), (3, 4, 5), (6, 7, 8, 9)]
for *_, last in tuples:
print(last)
# Prints: 2, 5, 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment