I am a pyhton beginner. I want to know that how to use local time of my country as an if criteria in python
import datetime
now = datetime.datetime.now()
print(now)
if 20>=now.hour>21:
print("Playing time")
else:
print("do whatever you want")
I have written this code but it's not working on local time
Aucun commentaire:
Enregistrer un commentaire