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