[issue23230] Bug parsing integers with zero padding
Mark Dickinson
report at bugs.python.org
Tue Jan 13 20:33:04 CET 2015
Mark Dickinson added the comment:
> is a base-10 zero padded comming from the parsing of a ip string
If you're parsing an ip string, how do you end up with a 000 *literal*? The SyntaxError only applies to literals in Python code; it doesn't affect conversion from strings to integers. So you don't need the "base=10" keyword: the following works in both Python 2 and Python 3.
>>> int("000")
0
>>> int("0019")
19
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23230>
_______________________________________
More information about the Python-bugs-list
mailing list