python 定时器
def run(): t = time.gmtime() hour = t.tm_hour + 8 minute = t.tm_min sec = t.tm_sec if hour < 10: hour = hour hour = '0' + str(hour) if minute < 10: minute = '0' + str(minute) if sec < 10: sec = '0' + str(sec) print str(hour) + '.' + str(minute) curTime = str(hour) + '.' + str(minute) SAKS.digital_display.show(curTime) # print("timer run:" ,time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))) global timer timer = threading.Timer(1, run) timer.start() timer = threading.Timer(0,run) timer.start()