Python Example | Hex Bytes to String Using utf-16

This python example code show us on how to convert python hex bytes to string using utf-16.

bytesObj = b'\x68\x00\x65\x00\x6c\x00\x6c\x00\x6f\x00'
string = bytesObj.decode('utf-16')
print(string)

Run this code, we will get:

hello