The unpacking assignment assigns elements of a tuple/list to variables at once.
x, y, z = (1, 2, 3)
print(x)
print(y)
print(z)1
2
3
Use _ to capture values to be ignored.
x, y, _ = (1, 2, 3)
print(x)
print(y)1
2
A variable prefixed with * captures all left values.
x, *y, z = (1, 2, 3, 4)
print(x)
print(y)
print(z)1
[2, 3]
4
* and _ can be combined togerther to ignore multiple values.
x, *_, z = (1, 2, 3, 4)
print(x)
print(z)1
4