Mohan Raj
Mohan Raj

Reputation: 197

python start_new_thread is printing None

from _thread import *
def worker():
print("this is a new thread")

start_new_thread(worker, ())

In the above python code it is printing none ,and i dont know why this happens

Upvotes: 0

Views: 44

Answers (1)

Doug
Doug

Reputation: 143

You could try putting your def and print function on the same line like this:

from _thread import *
def worker(): print("this is a new thread")

start_new_thread(worker, ())

Which output

18756
this is a new thread

Upvotes: 1

Related Questions