如何将十六进制字符串转换为文本
How do I convert hexadecimal string to text
如何将十六进制字符串转换为 Python 中的文本?
我得到了一个十六进制字符串
0x3C503E3235206D4C206F662033204D2048436C207765726520616464656420746F203735206D4C206F6620302E3035204D2048436C2E20546865206D6F6C6172697479206F662048436C20696E2074686520726573756C74696E6720736F6C7574696F6E20202026656D73703B26656D73703B26656D73703B26656D73703B2020200D0A20202026656D73703B26656D73703B26656D73703B26656D73703B2020697320617070726F78696D6174656C792D
我想借助 Python 将其转换为文本。我该怎么做?
我试过了
print(bytes.fromhex(xyz))
其中 xyz
是我存储此字符串的变量,但我收到此错误
non-hexadecimal number found in fromhex() arg at position 1
只需从字符串开头切出 '0x'
个字符。所以
print(bytes.fromhex(var[2:]))
会给予
b'<P>25 mL of 3 M HCl were added to 75 mL of 0.05 M HCl. The molarity of HCl in the resulting solution      \r\n      is approximately-'
如何将十六进制字符串转换为 Python 中的文本?
我得到了一个十六进制字符串
0x3C503E3235206D4C206F662033204D2048436C207765726520616464656420746F203735206D4C206F6620302E3035204D2048436C2E20546865206D6F6C6172697479206F662048436C20696E2074686520726573756C74696E6720736F6C7574696F6E20202026656D73703B26656D73703B26656D73703B26656D73703B2020200D0A20202026656D73703B26656D73703B26656D73703B26656D73703B2020697320617070726F78696D6174656C792D
我想借助 Python 将其转换为文本。我该怎么做?
我试过了
print(bytes.fromhex(xyz))
其中 xyz
是我存储此字符串的变量,但我收到此错误
non-hexadecimal number found in fromhex() arg at position 1
只需从字符串开头切出 '0x'
个字符。所以
print(bytes.fromhex(var[2:]))
会给予
b'<P>25 mL of 3 M HCl were added to 75 mL of 0.05 M HCl. The molarity of HCl in the resulting solution      \r\n      is approximately-'