Here is my multiprocessing code.
from multiprocessing import Process
def print_func(continent = 'Asia'):
print('The name of continent is: ',continent)
if __name__ == "__main__":
names = ['America','Russia','Africa']
procs = []
proc = Process(target = print_func)
procs.append(proc)
proc.start()
for name in names:
proc = Process(target = print_func,args =(name,))
procs.append(proc)
proc.start()
for proc in procs:
proc.join()
But it shows no output! What am I doing wrong?
I want output like this:
The name of continent is: Asia
The name of continent is: America
The name of continent is: Russia
The name of continent is: Africa