How compare hex numbers?
Andreas Jung
andreas at andreas-jung.com
Sat Dec 14 06:49:37 EST 2002
--On Samstag, 14. Dezember 2002 11:41 +0000 Gustaf Liljegren
<gustafl at algonet.se> wrote:
> I'm trying to compare one hex number with another to see which is bigger:
>
> U = hex(U)
> if U < '0x10000':
'0x10000' is *NOT* a hex number. It is just a string.
You should compare it:
if U < 0x10000:......
---------------------------------------------------------------------
- Andreas Jung http://www.andreas-jung.com -
- EMail: andreas at andreas-jung.com -
- "Life is too short to (re)write parsers" -
---------------------------------------------------------------------
More information about the Python-list
mailing list