[英]Send WhatsApp message every 24 hours
我想使用 python 和 pywhatkit 庫每 24 小時自動發送一條 WhatsApp 消息。 這是我到目前為止得到的代碼:
import pywhatkit
pywhatkit.sendwhatmsg("+91xxxxxxxxxx", "Hello, world", 16, 00)
每 24 小時適配發送一次:
import pywhatkit
import time
while True:
time.sleep(86400) #86400 seconds in a day
pywhatkit.sendwhatmsg("+91xxxxxxxxxx","Hello, world", 16, 00)
我必須讓我的電腦全天候 24/7 才能工作。 有沒有更好的方法呢?
看到你可以使用 pywhatkit,並且可以使用 python 庫添加一個循環,這樣你可以獲得幾個小時
from datetime import datetime
# datetime object containing current date and time
now = datetime.now()
import time
time.strftime('%X') // '13:12:47'
time.strftime('%x') // '01/20/22'
time.strftime('%d') // '20' day
time.strftime('%m') // '01' month
time.strftime('%y') // '20' year
time.strftime('%H') // '01' hour
time.strftime('%M') // '01' minute
time.strftime('%m') // '01' second
但我建議不要使用 pywhatkit 而不是使用它,它非常快而且不會錯過,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.