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" <o0m...@hotmail.se>
Sender: tutor-bounces+delegbede=dudupay....@python.org
Date: Tue, 29 Nov 2011 15:54:59 
To: <tutor@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@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to