Adi*_*ngh 1 php python binary hex
我在下面的php中将此语句转换hex为binary.
$m=pack("H*" , "A88BE9L98990........");
Run Code Online (Sandbox Code Playgroud)
我需要在另一个python程序中做同样的事情吗?
有任何想法吗 ?
干杯,
该binascii模块具有binascii.unhexlify(hexstr)您想要的功能.
>>> import binascii
>>> binascii.unhexlify("A88BE9L98990")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Non-hexadecimal digit found
# Not sure why there's an L in there... take it out...
>>> binascii.unhexlify("A88BE9989900")
'\xa8\x8b\xe9\x98\x99\x00'
Run Code Online (Sandbox Code Playgroud)