How to create python bytes object from long hex string? Ask Question

How to create python bytes object from long hex string? Ask Question

I have a long sequence of hex digits in a string, such as

000000000000484240FA063DE5D0B744ADBED63A81FAEA390000C8428640A43D5005BD44

only much longer, several kilobytes. Is there a builtin way to convert this to a bytes object in python 2.6/3?

ベストアンサー1

result = bytes.fromhex(some_hex_string)

おすすめ記事