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 - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

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