hex oct int string coversions?

Ron Adam radam2 at tampabay.rr.com
Sun Nov 2 23:47:48 EST 2003


On Mon, 03 Nov 2003 03:41:16 +0100, "Martin v. Löwis"
<martin at v.loewis.de> wrote:

>Ron Adam wrote:
>
>> How do I covert a string hex or oct value to the correct int value?
>
>http://www.python.org/doc/current/lib/built-in-funcs.html#l2h-41
>
>Martin



That tells me how to convert an int to a hex or oct string using the
hex() and oct() functions, which I already know.   

The int() function will convert a string to an integer.  But it
doesn't understand  hex or oct from a string.,  You can type the hex,
or oct value as an argument for the int() function on the command line
and that works correctly.

So there must be a way to do it?  Am I missing a step?

_Ron






More information about the Python-list mailing list