from datetime import date
from datetime import time
start_time=time.time()
print(start_time)
Error message : type object 'datetime.time' has no attribute 'time'
But it work if i replace from datetime import time
to import time
why these works like these
CodePudding user response:
When you write
from datetime import time
there is a module named datetime
(a Python file datetime.py
) with a class named time in it:
while the line:
import time
means to import a different module named time
(time.py
).