How can I read 3 bytes as an integer?
Does struct module provide something like that?
I can read in 3 bytes and add an extra \x00 and then interpret it as a 4-byte integer, but that seems unnecessary.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The struct module has no option for 3-byte integers, so I think your idea of appending ‘\x00’ is the easiest way.