hex oct int string coversions?

Ron Adam radam2 at tampabay.rr.com
Mon Nov 3 00:51:16 EST 2003


On Mon, 03 Nov 2003 04:47:48 GMT, Ron Adam <radam2 at tampabay.rr.com>
wrote:

>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
>


It was there,  I wasn't looking at it correctly.   int(s,0) or
int(s,8)  works great.   Thanks Martin.  And also to Mike who pointed
it out to me in email.

I really need to get more sleep.  

_Ron






More information about the Python-list mailing list