Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert part of a python tuple (byte array) into an integer

Tags:

I am trying to talk to a device using python. I have been handed a tuple of bytes which contains the storage information. How can I convert the data into the correct values:

response = (0, 0, 117, 143, 6)

The first 4 values are a 32-bit int telling me how many bytes have been used and the last value is the percentage used.

I can access the tuple as response[0] but cannot see how I can get the first 4 values into the int I require.