converting hex number contained in a string to an integer
Jarkko Torppa
torppa at polykoira.megabaud.fi
Tue Jun 20 06:35:12 EDT 2000
More information about the Python-list mailing list
Tue Jun 20 06:35:12 EDT 2000
- Previous message (by thread): converting hex number contained in a string to an integer
- Next message (by thread): converting hex number contained in a string to an integer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <8ing7d$o6r$1 at nnrp2.deja.com>, ejfc at my-deja.com wrote: >Hello all, > >I have a string containing a number. This is an >hex number. How can I convert this to an integer? ... >How can I do this? I am sure it is really easy, >but I am just beginnig with >Python. >>> eval('0x32') 50 >>> import string # Forces base to 16(hex) >>> string.atoi('32',16) 50 # Guesses base from leading characters >>> string.atoi('0x32',0) 50 -- Jarkko Torppa torppa at staff.megabaud.fi Megabaud Internet-palvelut
- Previous message (by thread): converting hex number contained in a string to an integer
- Next message (by thread): converting hex number contained in a string to an integer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list