I cannot find out what this line is doing:
p = struct.pack(">b", x)+p[1:]
can you help me on this? I think it is placing sth at the end of the struct. Is is also possible to place sth in the middle of that struct? Things like: p = struct.pack(">b", x)+p[2:] don’t seem to help. Any ideas on this?
Regards
It replaces the first byte of
pwith a byte representing the value ofx. You may or may not have already read this, but here is the documentation for thestructmodule.Edit: To replace the second byte, try this: