python反复执行某个命令

#! /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)

posted on 2018-08-16 15:25  ExplorerMan  阅读(4636)  评论(0)    收藏  举报

导航