I have the following code:
s = ['01','06','11','16','21','26','31','36','41','46','51','56']
while True:
for a in s:
if time.strftime('%S') == a:
print 'YES'
else:
print time.strftime('%S')
time.sleep(1)
print a
And it doesn’t work.
Any ideas how to make it work?
In case, everytime the %S gets some of the value in s, it prints the 'YES'.
You need to call
sleepon every loop and look for the current seconds in your list of matches: