Thursday, April 30, 2020

Create an alarm in Python

import datetime, os, time

while True:
  rn = str(datetime.datetime.now().time())
  time.sleep(1)
  print(rn[:8])
  if rn[:5] == "22:47":
    os.system("Start 02_The_Rose.mp3")
    break

No comments:

Post a Comment