[Tutor] Making a function run every second.

delegbede at dudupay.com delegbede at dudupay.com
Tue Nov 29 16:22:42 CET 2011


In my opinion, you probably have to think of how many times it has to run. If you want to run forever, you can just make an infinite loop. 

Here's my try. 

import time

def myloop():
        while True:
                print 'Hi'
                time.sleep(1)


This would run forever and print Hi after every 1 second when you run the program. 

What exactly are you trying to achieve. 
Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: "Mic" <o0MB0o at hotmail.se>
Sender: tutor-bounces+delegbede=dudupay.com at python.org
Date: Tue, 29 Nov 2011 15:54:59 
To: <tutor at python.org>
Subject: [Tutor] Making a function run every second.

Hi

I want a function to run every second , how do I do that?

Say that the function look like this:

def hi():
    print("hi")


Thanks! 


Mic
_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list