Octal number problem
Erik Max Francis
max at alcyone.com
Thu Feb 20 05:02:36 CET 2003
Gary Duncan wrote:
> int (0100) yields 64, whereas as you point out
> int ("0100") yields 100.
> One of my Python books mentions int(N) and in an example
> quotes N but doesn't say that it forces base-10
Note that in Python 2.x there's an optional second argument to int,
which is the base when the first argument is a string (it defaults to
10). Specifying 0 for this base will let Python autodetect the base
(which isn't what you want here, but for future reference ...).
> Ain't the WEB wonderful :)
This is either Usenet or a mailing list, actually :-).
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Time is a storm in which we are all lost.
\__/ George Bernard Shaw
Erik Max Francis' bookmarks / http://www.alcyone.com/max/links/
A highly categorized list of Web links.
More information about the Python-list