Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python int to bytes

bytes = (-32757).to_bytes(2, 'little', signed = True) #store value in 2 bytes
#bytes 2 int
print(int.from_bytes([bytes[0], bytes[1]], 'little', signed=True)) #returns -32767

Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #python #int #bytes
ADD COMMENT
Topic
Name
2+2 =