Hello,
I am trying to convert and array of ints to hexadecimal numbers with the format as b'\x50\x15\'
When I use the struct.pack(">H", int) most numbers looks ok, but some get turned into ascii characters..
For example the int value 3360 becomes b' \r' and not b'\x0d\x20'
Another example:
I'm using a assert len(thisvalue) which is failing on these values.
Any tips would be appreciated!
-Per
I am trying to convert and array of ints to hexadecimal numbers with the format as b'\x50\x15\'
When I use the struct.pack(">H", int) most numbers looks ok, but some get turned into ascii characters..
For example the int value 3360 becomes b' \r' and not b'\x0d\x20'
Another example:
1 2 3 |
import struct minnepls = struct.pack( ">i" , 20500 ) print (minnepls) |
Output:b'\x00\x00P\x14'
Is there any way to get this to the format b'\x50\x15\x00'?I'm using a assert len(thisvalue) which is failing on these values.
Any tips would be appreciated!
-Per