Leading 0's syntax error in datetime.date module (Python 3.6)
Skip Montanaro
skip.montanaro at gmail.com
Thu May 10 07:28:09 EDT 2018
>
> This gave the following error:
>
> Syntax Error: invalid token: C:\Users\Virgil Stokes\Desktop\Important
> Notes_Files\CheckProcessingDate_02.py, line 7, pos 17
> d0 = date(2018,02,01)
>
Note that this is a Python syntax error. It actually has nothing to do with
the datetime module. In Python before version 3, leading zeroes were how
you specified octal (base 8) numbers. That changed in Python 3. If you slim
the start of PEP 3127, you'll learn the new notation.
https://www.python.org/dev/peps/pep-3127/
There is a section in that document about removal of the old syntax:
https://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax
Which is what bit you.
Skip
More information about the Python-list
mailing list