The import multiprocessing
The import time
Sing #
Def sing () :
For I in range (3) :
Print (" singing ")
Time. Sleep (1)
# dance
Def dance () :
For I in range (3) :
Print (" dance ")
Time. Sleep (1)
If __name__=="__main__ ':
Class # 2. Use the process to create process object
Var=multiprocessing. Process (target=sing)
Ded=multiprocessing. Process (target=dance)
Var. The start ()
Ded. Start ()
Traceback (the most recent call last) :
The File "D:/pythonProject/123/hm_34_ use multiple processes implement multitasking. Py", line 24, in & lt; module>
Sing_process=multiprocessing. Process (target=sing)
TypeError: 'module' object is not callable
CodePudding user response:
The process==& gt; ProcessCodePudding user response:
Thank you, thank you very muchCodePudding user response:
This is not a multi-process?