hexadecimal string to byte array in python

前端 未结 8 1916
孤城傲影
孤城傲影 2020-11-22 11:53

I have a long Hex string that represents a series of values of different types. I wish to convert this Hex String into a byte array so that I can shift each value out and co

8条回答
  •  悲&欢浪女
    2020-11-22 12:37

    provided I understood correctly, you should look for binascii.unhexlify

    import binascii
    a='45222e'
    s=binascii.unhexlify(a)
    b=[ord(x) for x in s]
    

提交回复
热议问题