3 ms·
Python 2.7.17 (default, Dec 31 2019, 23:59:25) Type "help", "copyright", "credits" or "license" for more information. >>> from datetime import datetime >
by user982 7y ago
Python 2.7.17 (default, Dec 31 2019, 23:59:25)
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.strptime('Sat 29 Feb 12:00:00 PM', '%a %d %b %I:%M:%S %p')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: day is out of range for month
- park_94110 7y agoThis is because 1900 is the default year in datetime. 1900 was not a leap year.
- user982 7y agoI know, I'm just providing a counterexample to phoobahr.