Created
March 21, 2017 00:17
-
-
Save mingrammer/023cf9bd80dccbd93620ae1b51096502 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
numbers = [1, 2, 3, 4, 5, 6] | |
# The left side of unpacking should be list or tuple. | |
*a, = numbers | |
# a = [1, 2, 3, 4, 5, 6] | |
*a, b = numbers | |
# a = [1, 2, 3, 4, 5] | |
# b = 6 | |
a, *b, = numbers | |
# a = 1 | |
# b = [2, 3, 4, 5, 6] | |
a, *b, c = numbers | |
# a = 1 | |
# b = [2, 3, 4, 5] | |
# c = 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment