对于Python3 +,int有一个方法
>>> A=[0xaa, 0xbb, 0xcc]
>>> hex(int.from_bytes(A, byteorder="big"))
'0xaabbcc'
>>> 0xaabbcc == int.from_bytes(A, byteorder="big")
True
Run Code Online (Sandbox Code Playgroud)
对于Python2,最好编写一个小函数
>>> A = [0xaa, 0xbb, 0xcc]
>>>
>>> def to_hex(arr):
... res = 0
... for i in arr:
... res <<= 8
... res += i
... return res
...
>>> 0xaabbcc == to_hex(A)
True
Run Code Online (Sandbox Code Playgroud)