Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Packing | Packing and Unpacking
Intermediate Python Techniques
course content

Contenido del Curso

Intermediate Python Techniques

Intermediate Python Techniques

1. Packing and Unpacking
2. Arguments in Function
3. Function as an Argument
4. Variable Scope
5. Decorators

bookPacking

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.

1
*a, *b = 1, 2, 3, 4
copy
1
*a, *b, *c = 1, 2, 3
copy
Can you use more than one iterable unpacking operator in a single expression?

Can you use more than one iterable unpacking operator in a single expression?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 2
We're sorry to hear that something went wrong. What happened?
some-alt