Here's a Python 3 version. It uses the struct.unpack method to build a big-endian 4-byte integer:
>>> import struct
>>> x=(65,222,102,102)
>>> struct.unpack('>L',bytes(x))[0]
1105094246
The Python 2 version doesn't have bytes
, so use pack to build the byte string that will be unpacked:
>>> import struct
>>> x=(65,222,102,102)
>>> struct.unpack('>L',struct.pack('4B',*x))[0]
1105094246
The *x
syntax expands the tuple into the four parameters expected by pack
.