python定时任务

#!/usr/bin/env python
# -*- coding:utf-8 -*-
from time import sleep
import datetime
import time
import subprocess
time1=1
str=time.strftime("%M",time.localtime())
while True:
    if(str == "30"):
        print("已到30分")
    print("定时程序")
    sleep(time1)
    str=time.strftime("%H",time.localtime())

你可能感兴趣的:(python定时任务)