sleep - Python: Perform ations repeatedly over a time interval, as long as a condition is true -
so i'm trying (access file on website, read contents , perform actions until content says exit. precondition being has wait x seconds before accessing website again; recheck contents):
perform = true while(perform): data = urllib.urlopen('someurl') data = data.read() if(data == '0'): dosomething() elif(data == '1'): #1 signifies exit loop perform = false else: time.sleep(10)
however never seems work. 'someurl' has value. google says it's sleep function. please help!
this:
import time while true: print "fetching" time.sleep(10)
is minimal test case , works can't problem time.sleep
function
Comments
Post a Comment