Trying to use dateutil to parse dates from an unknown format but none of the documented methods are found?
CODE:
import dateutil
print(dateutil.parser.parse("24.05.2017"))
exit(1)
ERROR:
Traceback (most recent call last):
File "test.py", line 2, in <module>
print(dateutil.parser.parse("24.05.2017"))
AttributeError: module 'dateutil' has no attribute 'parser'
As an alternative to the accepted answer, the dotted notation is still valid if you change the import:
import dateutil.parser
print(dateutil.parser.parse("24.05.2017"))
You can fix this error by modifying your code slightly:
from dateutil import parser
print(parser.parse("24.05.2017"))
This change is needed because of how the dateutil package internally organizes it's modules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With