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 -
>>> 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
1 984
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 -
>>> 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
first look, you did not return any values in your debtcheck() function that's why you have None.. return debt_data in that function, and i think it should be fine.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: |
last post by:
I have a page here that validates as XHTML 1.0 strict that works fine in
Safari, Mozilla, and IE for the PC, but in IE 5.2 for the Mac it's all
messed. Text that is supposed to be inside a table...
|
by: Marina |
last post by:
Hi,
I was playing around with a tool available from gotdotnet to create
documentation from xml comment in vb.net. Part of what I had to do was
install an add in to allow help projects to be...
|
by: ftw |
last post by:
I am using SQL7 Query Analyzer. A simple select * from myMLSview and
then I save results as a .csv file has the commas messed up in quite a
few places. The data is messed up before I save it to the...
|
by: A_StClaire_ |
last post by:
hi,
wrote the following program to learn a bit about auto pointers.
weird thing is, the char array 'name' with size 'max_size' displays a
bunch of messed up symbols after the "John Smith" if...
|
by: Danny |
last post by:
Hi again
I am trying to import from an excel spreadsheet into access 2002, but the
order that is in the spreadsheet is not preserved when I import. using
DoCmd.TransferSpreadsheet in code.
...
| |
by: accesstribe |
last post by:
Hello, I have DB located on network, and network cable was cut off
accidently few days ago... now its fixed, but I can't add new records
to the DB with forms...
The error I get is this (when...
|
by: Simon Wallis |
last post by:
I have a main Listing aspx page in my app with links to a Details page. Both hit an access database. The Listing page runs a query against the db, and binds the resulting DataView to a DataGrid...
|
by: David C. Barber |
last post by:
Using SQL Server 2000 and moving to a new computer. We did a full backup of
the existing database to tape, brought up the new computer with a clean
install using the same server name and IP...
|
by: quagmireman |
last post by:
I am very new to perl... today is my first encounter. and i think i messed up pretty big.
I was trying to update some info on a website, so i thought I could just open the index.pl file and change...
|
by: RZ15 |
last post by:
Hi,
I was working on a query this morning and everything was working fine. Some time in the last half hour, I used the Compact & Repair Database feature. After that, when I went to open the query...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |