展开全部
sleep就可以吧,把程序作为一个线程,启动线程,里面加个sleep,示例如下:
import threading
import time
class Test(threading.Thread):
def __init__(self):
pass
def test(self):
print 'run test!'
def run(self):
while True:
print time.strftime('%Y-%m-%d %H:%M:%S')
self.test()
time.sleep(5)
#test...
a=Test()
a.run()
#...test
import threading
import time
class Test(threading.Thread):
def __init__(self):
pass
def test(self):
print 'run test!'
def run(self):
while True:
print time.strftime('%Y-%m-%d %H:%M:%S')
self.test()
time.sleep(5)
#test...
a=Test()
a.run()
#...test
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询