RSS Feed
page top anchor

Wait for it

import time
from datetime import datetime

while True:
# Get the current time
now = datetime.now()

# Check if it's midnight (00:00:00)
if now.hour == 0 and now.minute == 0 and now.second == 0:
print("Happy New Year!")
break # Exit the loop after printing the message

# Wait for 1 second before checking again
time.sleep(1)

[Published: ]