problem with bcd and a number

Chris Angelico rosuav at gmail.com
Fri Aug 5 11:32:03 EDT 2011


On Fri, Aug 5, 2011 at 1:40 AM, Dan Stromberg <drsalists at gmail.com> wrote:
>>>> print int(hex(0x72).replace('0x', ''))
> 72

Or simpler: int(hex(0x72)[2:])

Although if you have it as a string, you need to ord() the string.

It's probably better to just do the bitwise operations though.

ChrisA



More information about the Python-list mailing list