可能重复:
I'm new to python, I can't tell if this will work or not我不知道这段代码有什么问题吗?
import time
from sys import stdout
varthing = 1
while varthing == 1:
time.sleep(1)
checker = time.strftime("\r%b, %d %H:%M:%S", time.localtime())
print checker,
stdout.flush()
if checker == "Dec, 25 00:00:00" :
print "It's Christmas"
raw_input("Enter anything to close\n")
varthing = 0
我看不出有什么不妥。这是圣诞节时通知你的时钟。
你有什么期望发生,而是发生了什么? –
什么也没有发生,它只是计数,当它达到指定的日期时,什么都不会发生。 – user1080694