[英]Scheduling a simple notification script in Python to run every hour
我對 Python 完全陌生。
我剛剛編寫了這個在我的桌面上打印一條消息的簡單腳本:
from plyer import notification
notification.notify(
title="HI MATTEO!",
message="Here's the notification to be sent every hour!",
timeout=10
)
我想知道是否有辦法每小時(或在給定時間)運行此通知
非常感謝
馬泰奧·福薩蒂
您應該查看schedule
package ( https://pypi.org/project/schedule/ )。
然后,運行類似:
schedule.every().hour.do(my_notification)
...
while True:
schedule.run_pending()
time.sleep(1)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.