Module info:

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]

C:\Python36>pip show datetime
Name: DateTime
Version: 4.2
Summary: This package provides a DateTime data type, as known from Zope 2. Unless you need to communicate with Zope 2 APIs, you're probably better off using Python's built-in datetime module.
Home-page: http://pypi.python.org/pypi/DateTime
Author: Zope Foundation and Contributors
Author-email: zope-...@zope.org
License: ZPL 2.1
Location: c:\python36\lib\site-packages
Requires: zope.interface, pytz

I tried first to use Python's built-in datetime module as follows:

from datetime import date, timedelta

 d0 = date(2018,02,01)

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)

Then I used pip to install the datetime module and the same error occurred! However, when I removed the leading 0's no syntax error was reported and the correct result was returned.

d0 = date(2018,2,1)

Why does the datetime.date  module (both built-in and site-package) not accept leading 0's?



--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to