difference between sunprocessPopen and Process in python
subprocess.Popen() is a function in the subprocess module that allows you to spawn a new process and execute a command in it. It returns a Popen object which represents the spawned process.
Process() is a class in the multiprocessing module that allows you to create a new process and execute a function in it. It returns a Process object which represents the spawned process.
The main difference between the two is that subprocess.Popen() is used for running external commands, while Process() is used for running Python functions in a separate process.
Another difference is that Process() is part of the multiprocessing module, which provides a way to run Python code on multiple cores or CPUs, while subprocess.Popen() is part of the subprocess module, which is used for managing system processes.
In summary, subprocess.Popen() is used for running external commands and Process() is used for running Python functions in a separate process, and Process() is part of the multiprocessing module which provides a way to run Python code on multiple cores or CPUs
原文地址: https://www.cveoy.top/t/topic/cS0i 著作权归作者所有。请勿转载和采集!