参考:Python3 字符串与hex之间的相互转换_Python热爱者的博客-CSDN博客_python 字符串转hex
##hex转字符串
a = '61626364656667'
a_bytes = bytes.fromhex(a)
print("hex to string:",a_bytes.decode())
##字符串转hex
b = b'HelloWorld'
b_bytes = bytes.hex(b)
print("string to hex:",b_bytes)
参考:Python3 字符串与hex之间的相互转换_Python热爱者的博客-CSDN博客_python 字符串转hex
##hex转字符串
a = '61626364656667'
a_bytes = bytes.fromhex(a)
print("hex to string:",a_bytes.decode())
##字符串转hex
b = b'HelloWorld'
b_bytes = bytes.hex(b)
print("string to hex:",b_bytes)