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
Post a Comment