python doesn't like my numbers
Leif K-Brooks
eurleif at ecritters.biz
Sun Aug 22 18:52:50 EDT 2004
paul k wrote:
> is there any way to convince python not to take my (phone)numbers
> starting with zero as octals?
>
> >>> int(088)
> File "<stdin>", line 1
> int(088)
> ^
> SyntaxError: invalid token
Why do they have to start with zeros in your source code?
The fact that you're passing the number through int() makes me guess
that you're actually talking about input of some kind which you'll pass
through int(). If that's the case, they will be strings, and the problem
will go away:
>>> int('088')
88
More information about the Python-list
mailing list