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++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -