Octal number problem

Raymond Hettinger vze4rx4y at verizon.net
Thu Feb 20 03:27:37 CET 2003

[Gary Duncan]
> Python has the quaint behaviour of interpreting
> a numeric string with a leading zero as octal, a bit like C.
> How does one disable this behaviour, ie get it to
> treat such strings as a "normal" decimal number ?

The int() function will assume base 10 and ignore the
leading zero cue for octal:

>>> int("0100")

Raymond Hettinger

More information about the Python-list mailing list