I have:
a, b, c, d, e, f[50], g = unpack('BBBBH50cH', data)
The problem is
f[50] (too many values to unpack)
How do I do what I want?
I think by f[50]
you are trying to denote "a list of 50 elements"?
In Python 3.x you can do a, b, c, d, e, *f, g
to indicate that you want f
to contain all the values that don't fit anywhere else (see this PEP).
In Python 2.x, you will need to write it out explicitly:
x = unpack(...)
a, b, c, d, e = x[:5]
f = x[5:55]
<etc>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With