Datetime module import doubt
when we write from datetime import date it only includes date variable from datetime variable to import time we again type import datetime my question is why can't we import datetime module for both date and time?
from datetime import date from datetime import time
the second statement from datetime import time doesn't work can't we just import datetime module for all date & time related purposes
yes, you can. the difference is how you will be able to call your function in the code : date for the former, and datetime.date for the latter. you can also : import datetime as dt then the call will be shorter: dt.date