what does the comma mean in python's unpack?
问题 we can simply use: crc = struct.unpack('>i', data) why people like this: (crc,) = struct.unpack('>i', data) what does the comma mean? 回答1: The first variant returns a single-element tuple: In [13]: crc = struct.unpack('>i', '0000') In [14]: crc Out[14]: (808464432,) 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] : In [15]: (crc,) = struct.unpack('>i', '0000') In [16]: crc Out[16]: 808464432 回答2: the unpack