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

C++: Boost interprocess memory mapped file error -

python - IO.UnsupportedOperation: Not Writable -

python - malformed header from script index.py Bad header -