hex to int

Skip Montanaro skip at pobox.com
Thu Feb 14 18:00:25 EST 2002


    >>> int('0xff', 16)
    255

    >> In what version of Python do they introduce that?  

    Jason> Waaaaay back in Python 1.6.

Just for the record, if you're still stuck with 1.5.2, string.atoi supports
the same interface:

    >>> string.atoi("0xff", 16)
    255

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list