Python unpacking and packaging
The number of variables is inconsistent with the number of tuples
For example:
t3 = (3,6,7,5,9,8,3)
a,*b = (3,6,7,5,9,8,3)
1. Python interpreter bottom layer: 3, 6,7,5,9,8,3
2. Assignment
a = 3
*b = 6 7 5 9 8 3 The
bottom layer has the symbol ※, ※ b = 6 7 5 9 8 3 -----> [6, 7,5,9,8,3], here, the bottom layer has done a package operation. And assign (packaging) the list value to b.
3. Print
*b in the print indicates the unpacking operation.
The code is as follows: Application
in variable parameters and keyword parameters. When
calling func (**dict1), ** represents unpacking
. When defining functions, **kwargs represents packaging, assembled into a dictionary