Skip to content

Instantly share code, notes, and snippets.

@edenau
Last active December 27, 2019 16:38
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 edenau/da1e354a509d4129db47545f44a5028d to your computer and use it in GitHub Desktop.
Save edenau/da1e354a509d4129db47545f44a5028d to your computer and use it in GitHub Desktop.
Python Unpacking
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