Python: get int value from a char string -
this 1 of silly questions , don't know how formulate it, i'll give example. got
v = chr(0xae) + chr(0xae)
where #aeae is, in decimal, value of 44718.
my question how integer value of v
? know ord()
can use char, , not string.
thank you.
i managed using struct
module:
import struct int_no = struct.unpack('>h', v)[0] print int_no
which outputs desired results:
44718
Comments
Post a Comment