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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -