Conteúdo do Curso
Intermediate Python: Arguments, Scopes and Decorators
Intermediate Python: Arguments, Scopes and Decorators
Packing
To pack multiple variables, you need to use the *
iterable unpacking operator. Simply place an asterisk *
before the variable, and it will pack any number of variables. Packing a variable is only possible within a tuple or a list.
But the SyntaxError will occur if to use more than one unpacking operator.
*a, *b = 1, 2, 3, 4
*a, *b, *c = 1, 2, 3
Obrigado pelo seu feedback!