from time import time, ctime
prev_time = ""
while(1):
the_time = ctime(time())
if(prev_time != the_time):
print "The time is:",ctime(time())
prev_time = the_time
|
The time is: Sun Aug 20 13:40:04 2000
The time is: Sun Aug 20 13:40:05 2000
The time is: Sun Aug 20 13:40:06 2000
The time is: Sun Aug 20 13:40:07 2000
Traceback (innermost last):
File "clock.py", line 5, in ?
the_time = ctime(time())
KeyboardInterrupt
|