how to run list of functions using Thread?

+1 vote

We have a file called and in that list f has 4 functions like :

f = [f1,f2,f3,f4]

which f[0]() call f1! the question is to call every list member using Thread and put the code in solve function ! but two notes are important :

  1. Call all of members in on time!
  2.  Threads could be not same as the others.
def solve(f):
    for i in range(4):
        x = threading.Thread(target=f)
    for anyt,j in enumerate(th):

What's the problem? could anyone helps me?

Aug 24, 2019 in Python by Andres

1 answer to this question.

0 votes

You could import the file with function onto the file where you're calling them in the solve function. 

def solve(f)
threads = list()
    for index in range(4):
        x = threading.Thread(target=thread_function, args=(index,))
answered Aug 26, 2019 by Vishaka

Related Questions In Python

0 votes
2 answers
0 votes
1 answer

Using list comprehension how to call list of function

For the class method when used as ...READ MORE

answered Nov 14, 2018 in Python by Theodor
• 740 points
0 votes
1 answer

how to run test cases of different modules with same marker at a time using pytest

Hey,@Nikitha, Suppose you have multiple files say, To ...READ MORE

answered Apr 28 in Python by Gitika
• 41,360 points
0 votes
1 answer

How to sort a list of strings?

Basic answer: mylist = ["b", "C", "A"] mylist.sort() This modifies ...READ MORE

answered Jun 4, 2018 in Python by aryya
• 7,380 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,452 views
0 votes
0 answers
0 votes
1 answer

How to get the multiplication table of any number using list comprehension?

Hey @Neha, you can use something like ...READ MORE

answered Jul 8, 2019 in Python by Sakshi
0 votes
1 answer

How to get the return value from a thread using python?

You don't need to change your existing ...READ MORE

answered Dec 3, 2018 in Python by Nymeria
• 3,520 points

edited Dec 19, 2018 by Nymeria 42,028 views