https://www.docin.com/p-2121031113.html
需要使用的timer模块如下
```python
import threading
import time
def fun_timer():
global timer, hours
hours += 1
if hours > 23:
hours = 0
timer = threading.Timer(5.0, fun_timer)#5s执行一次fun_timer
timer.start()
def main():
global hours
hours = 0
fun_timer() #启动定时器
while True:
print()
command = input("Command:")
if command == "print":
print("Now is %-2d"%hours)
elif command == "quit":
print("Bye.....")
timer.cancel()
break
if __name__ =="__main__":
main()