Skip to content
Advertisement

What does the comma mean in Python’s unpack?

We can simply use:

JavaScript

why do people write it like this:

JavaScript

What does the comma mean?

Advertisement

Answer

The first variant returns a single-element tuple:

JavaScript

To get to the value, you have to write crc[0].

The second variant unpacks the tuple, enabling you to write crc instead of crc[0]:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement