So I'm trying to just write a script that checks to see the national debt every minute for 3 minutes. (the time and duration is completely variable, im making up these tests for me to learn on)...
So the script I have, which I've written by cutting and pasting from previous questions i've had answered and from what i've found on python.org, yields "None," rather than 3 gigantic debt figures.
Can someone help me (i'm using Windows XP on python 2.5) find where I've gone arwy...
thanks a lot...
PC
So the script I have, which I've written by cutting and pasting from previous questions i've had answered and from what i've found on python.org, yields "None," rather than 3 gigantic debt figures.
Can someone help me (i'm using Windows XP on python 2.5) find where I've gone arwy...
thanks a lot...
PC
Code:
>>> def debtcheck(): ... webpage = urllib2.urlopen('http://www.brillig.com/debt_clock/') ... results2 = webpage.read() ... total_debt = re.compile('<TR><TD ALIGN=center><IMG SRC="debtiv.gif" WIDTH=399 HEIGHT=41 ALT=(.*?)</TD>',re.M|re.DOTALL) ... debt_data = total_debt.findall(results) ... >>> import sched, time >>> s=sched.scheduler(time.time, time.sleep) >>> def print_debt(): ... s.enter(5, 1, debtcheck, ()) ... s.enter(65, 1, debtcheck, ()) ... s.enter(125, 1, debtcheck, ()) ... s.run() ... >>> def print_debt(): ... s.enter(5, 1, debtcheck, ()) ... s.enter(65, 1, debtcheck, ()) ... s.enter(125, 1, debtcheck, ()) ... s.run() ... >>> print print_debt() None
Comment