xuzijie

1.首先安装 schedule 模块

命令行安装 

pip install schedule

pyCharm编辑器安装

File->setting->project:youProject->Project Interpreter->点+号->搜索->install按钮

2.代码

# coding:utf8

from bs4 import BeautifulSoup
import schedule
import time
import urllib2

def job():
print ("I\'m working")

schedule.every().minutes.do(job)

while True:
schedule.run_pending()
time.sleep(1)

时间段选择

schedule.every(10).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
schedule.every(5).to(10).days.do(job)
schedule.every().monday.do(job)
schedule.every().wednesday.at("13:15").do(job)

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-02-14
  • 2021-08-13
  • 2022-01-14
  • 2021-11-11
  • 2021-11-29
  • 2022-12-23
猜你喜欢
  • 2020-02-18
  • 2021-09-27
  • 2022-12-23
  • 2021-12-02
  • 2021-10-17
  • 2022-12-23
相关资源
相似解决方案