Skip to content
Advertisement

Python datetime module problems

I’m using the datetime module in python3.7. When I run it from terminal it throws an error:

JavaScript

Advertisement

Answer

As you named your file datetime.py it may lead to confusion when calling it from outside.

you should rename it to something else like my_datetime.py

you also need to import datetime before using it

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement