Created
October 29, 2015 08:51
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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