Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Simple Thread In Python

DZone's Guide to

Simple Thread In Python

·
Free Resource
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:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}