0
请告诉我如何确保函数printit()每秒执行一次?每x秒运行一次代码
import threading
def printit():
print("Hello, World!")
threading.Timer(1.0, printit).start()
的问题是, '世界你好' 只出现一次
请告诉我如何确保函数printit()每秒执行一次?每x秒运行一次代码
import threading
def printit():
print("Hello, World!")
threading.Timer(1.0, printit).start()
的问题是, '世界你好' 只出现一次
如何
import time
while True:
time.sleep(1)
print ('Hello world')
也:http://stackoverflow.com/questions/510348/how-can-i/-make-A-延时功能于蟒510351#510351 –