python十六进制字符串转十六进制

str_test = '0x12345678'

str_int = int(str_test,16)

hex_int = hex(str_int)

print(hex_int )

>> 0x12345678

你可能感兴趣的:(python,python)