> > I've got this so far: > > > > #!/usr/bin/env python > > #coding=utf-8 > > import time > > b = '20:00:00' > > while True: > > a = time.strftime('%H:%M:%S') > > time.sleep(0.5) > > if a == b: > > print "TIME!" > > break > >
It needn't to make this comparison in every 0.5 seconds. Calculate how long to sleep and ask that from the pc. import time b = '20:00:00' (bhour, bmin, bsec) = b.split(':') bsec = int(bsec) + int(bmin)*60 + int(bhour)*360 while True: act = time.localtime() actsec = act.tm_sec + act.tm_min*60 + act.tm_hour*360 wait = bsec - actsec if wait < 0: wait += 360*24 # it will be tomorrow time.sleep(wait) print 'I am doing!' break Regards, Janos _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor