What is the use of join()?

0 votes
Python join() method
Jun 20 in Python by Nisa
• 1,090 points
21 views

1 answer to this question.

0 votes
Join()  function is used in threading to make the main thread wait for the child thread to finish before taking the control from it.

Example:
import threading
import time
class mythread(threading.Thread):
    def run(self):
        for x in range(7):
        print("Hi from child")
a = mythread()
a.start()
a.join()
print("Bye from",current_thread().getName())
Output:
Hi from child
Hi from child
Hi from child
Hi from child
Hi from child
Hi from child
Hi from child
Bye from MainThread
answered Jun 20 by Wajiha
• 1,920 points

Related Questions In Python

+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,420 points
1,595 views
0 votes
2 answers

What is the use of Python language?

python is general purpose programming language.it very ...READ MORE

answered Mar 15 in Python by rajesh kumar
48 views
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
118 views
0 votes
1 answer

What is the use of “assert” keyword in Python?

You can try the following in a ...READ MORE

answered Oct 15, 2018 in Python by Priyaj
• 56,920 points
86 views
0 votes
0 answers

what is the use of args and kwargs in python?

can you an example for each? READ MORE

May 10 in Python by Waseem
• 4,470 points
59 views
0 votes
0 answers

What is the use of get requests in python?

What are the other http requests in ...READ MORE

May 30 in Python by Waseem
• 4,470 points
23 views
0 votes
0 answers

what is the use of python math module?

what are different functions that we can ...READ MORE

Jun 7 in Python by Waseem
• 4,470 points
24 views
0 votes
1 answer

What is timedelta in python?

It represents a duration which is basically ...READ MORE

answered Aug 7 in Python by Wajiha
• 1,920 points
32 views