type conversion - How to convert variable into integer in python? like in php (int) -


i have variable value ="\x01" database, how can convert integer. have searched internet had no success in finding anything.

anyone have idea?

in php, there build-in module convert it. there similar module function in python?

simple answer use ord().

>>> = '\x01' >>> ord(a) 1 

but if performance looking refer @chepner's answer.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -