Last active
December 27, 2019 16:38
-
-
Save edenau/da1e354a509d4129db47545f44a5028d to your computer and use it in GitHub Desktop.
Python Unpacking
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
a, b, c, d = aList[0:4] | |
print(f'a = {a}, b = {b}, c = {c}, d = {d}') | |
# a = 0, b = 1, c = 2, d = 3 | |
a, *b, c, d = aList | |
print(f'a = {a}, b = {b}, c = {c}, d = {d}') | |
# a = 0, b = [1, 2, 3, 4, 5, 6, 7], c = 8, d = 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment