python将一段字符串转换成16进制 In [6]: binascii.b2a_hex(bytes(M,encoding='utf-8')) Out[6]: b'656e6372797074696f6e207374616e64617264'