-
实践从信息领域网站爬取热词。
-
学习定时任务(
cron)设置。
# 使用 schedule 库设置定时任务
import schedule
import time
def job():
print("Fetching hot words...")
hot_words = fetch_hot_words("https://example.com/hot-words")
print(hot_words)
schedule.every().day.at("08:00").do(job)
while True:
schedule.run_pending()
time.sleep(1)
浙公网安备 33010602011771号