zl程序教程

您现在的位置是:首页 >  后端

当前栏目

python反复执行某个命令

Python执行命令 某个 反复
2023-09-14 09:12:29 时间
#! /usr/bin/env python
#coding=utf-8
# 以需要的时间间隔执行某个命令
  
import time, os
  
def re_exe(cmd, inc = 60):
 while True:
  os.system(cmd);
  time.sleep(inc)
  
re_exe("echo %time%", 5)