In python, long integers have an unlimited range. Is there a simple way to convert a binary file (e.g., a photo) into a single long integer?
Share
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.
Using the bitstring module it’s just:
If you prefer you can get a signed integer using the
intproperty.Internally this is using
struct.unpackto convert chunks of bytes, which is more efficient than doing it per byte.