module 'datetime' has no attribute 'strptime' 1

module ‘datetime’ has no attribute ‘strptime’

Use this: from datetime import datetime
instead of Import datetime

Here is what the above code is Doing:
1. It’s importing the datetime module from the Python standard library.
2. It’s creating a datetime object representing the current date and time.
3. It’s printing the current date and time to the console.

If you want to just print the current date, you can use the datetime.date object:

from datetime import datetime

print(datetime.date.today())

Similar Posts