DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Simple Thread In Python

03.11.2006
| 12213 views |
  • submit to reddit
        Taken from <a href=http://linuxgazette.net/107/pai.html>this article</a>.

import time
import thread

def myfunc(string,sleeptime):
    while 1:
        print string
        time.sleep(sleeptime)

thread.start_new_thread(myfunc,("Thread No:1",2))
# Then do other things.