Code doesnt work in python ide


#1
from datetime import datetime
now = datetime.now()
print ('now')

this code works in the codeacademy ide but it shows error in the python 3 . 6. 4 idle which i have installed.


#2

doesn’t work can mean many things, can you show in more detail what doesn’t work? Error message? Screenshot?

why are you printing a string, why not the variable which contains the current datetime


#3


#4

Your module is importing itself, not the built-in datetime module (rename your file)


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.