Over a million developers have joined DZone.

Simple Thread In Python

·
Taken from this article.


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.
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}