When I try to do the following:
struct.pack("B",32)
The 32 is a int
type.
I am expecting "\x20"
, but I get the following (blank): " "
I need this as a byte using struct()
because I want to put it in a bytearray()
, to look like this:
bytearray(b'\x20')
I've tried other encoding on the struct.pack()
besides "B", but I could've left something out.
If you do this:
you will see that you are getting what you are expecting, just in a representation that you are not expecting.