字符串/16/10进制互转2023-03-10
2023-03-24 本文已影响0人
夏树的宝马
print("字符串->16->10->16-字符串")
a="浮点数"
hex_c=a.encode()
print(hex_c,'unicode')
hex_a=hex_c.hex()
print(hex_a,"byte->16")
hex_to_10=int(hex_a,base=16)
print(hex_to_10,'16->10进制')
print(hex(hex_to_10),'10->16')
c=str(hex(hex_to_10).replace("0x",''))
print(c,"16进制去掉0x")
print(bytes.fromhex(c).decode())