Integer won't fully read as an integer


Writing some python code and doing a tutorial (I’m new to programming). I’ve done a lot of things that worked just fine. Came upon a really weird problem today.

     final = years + months + days + leap_year
     print (final)
     return final

The number 02082016 refuses to be accepted as an integer. Atom only reads “020” as an integer, and “82016” as text. If I remove the 8, it works. If I put the 8 back in, it splits it into an integer and code again.

See image below.


I’m pretty sure numbers with a leading 0 in Python are treated as octal literals. Remove the leading 0 and you should be fine.


Ha, only that messes up my code entirely. I parse out the first two digits. Numbers 01-12. That means I’ll have to redo everything…

Oh well, I guess that’s the way it goes.

Thanks for the help!


Ok, time to clarify (sorry, I don’t know Python). If you’re using Python 2.x, then my comment above is correct. HOWEVER, if you’re using Python 3.x, then it is a bug in language-python. If so we’re planning on entirely reworking the language support for Python - you might want to subscribe to