Python: Convert Hex String to Bytes Array
To convert the hexadecimal string '7101540201' to a bytes array in Python, you can use the bytes.fromhex() method. Here's an example:
hex_string = '7101540201'
bytes_array = bytes.fromhex(hex_string)
print(bytes_array)
Output:
b'q\x01T\x02\x01'
In the output, b'q\x01T\x02\x01' represents the bytes array where each character is represented by its hexadecimal value.
原文地址: http://www.cveoy.top/t/topic/dovj 著作权归作者所有。请勿转载和采集!