grocery_stocker <cdal...@gmail.com> wrote:

>On Apr 23, 3:29 pm, Chris Rebert <c...@rebertia.com> wrote:
>> On Thu, Apr 23, 2009 at 3:21 PM, grocery_stocker <cdal...@gmail.com> wrote:
>> > Say I have a script that fetches data from a website every hour. Is
>> > there a general solution or is the solution operating system specific?
>>
>> WRT the periodic operation part of your task, there's the `sched`
>> module --http://docs.python.org/library/sched.html
>
>Maybe I'm being a tad bit dense here, but I don't see how this
>schedule mod can be used to fetch data from a website every hour for
>10 hours straight...

Really?
    s = sched.scheduler( time.time, time.sleep )
    for hour in range(10):
        s.enter( 3600 * hour, 1, fetch_website, () )
    s.run()

>and why this is different than using something like time.sleep().

It's not different.  sched.scheduler uses time.sleep.  It just does so in
an abstracted way.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to