티스토리 뷰

개발/Python

python bytearray to hex string

Dallaenae 2022. 12. 7. 09:52
bytearray to hex string
 
bytesvalue = b'\xf0\xf1\xf2\xf3\xf4\xf5'

hexvalue = bytesvalue.hex()
print(hexvalue)

 

 

hex string to bytearray

hexstring = 'f0f1f2f3f4f5'

datafromhex = bytes.fromhex(hexstring)
print(datafromhex)
반응형

'개발 > Python' 카테고리의 다른 글

[Python] Hex string to Int, bytes와 bytearray 활용  (0) 2022.03.15