Jan-17-2022, 12:06 AM
Depends on the order they need to be converted.
Do you have an example of the bytes that you receive and know the specific integer that it should form? Your code seems reasonable for converting a set of bytes in little-endian format. Big-endian would need a
Do you have an example of the bytes that you receive and know the specific integer that it should form? Your code seems reasonable for converting a set of bytes in little-endian format. Big-endian would need a
">I"
format.>>> struct.unpack("<I", bytes([35, 0, 0, 0])) (35,)