Starting with the python2.4 version, you can use the Subprocess module to generate child processes and connect to the child process's standard input/output/error, as well as to get the return value of the child process.Subprocess is intended to
When we need to call system commands, we should first consider the OS module. Use OS. System () and OS. popen () for operations. However, these two commands are too simple to complete complex operations, such as providing input or reading command
Popen, Pclose-pipe stream to or from a processFILE *popen (const char *command, const char *type);int Pclose (FILE *stream);DescribeThe Popen () function opens a process by creating a pipe, forking, and invoking the shell. Since a pipe is by
Python subprocess. Popen communicate () and wait () usage difference, pythonpopenwait
The reason for this problem is that the program has not returned since the wait method of Popen is called. Google found that wait may cause deadlocks. To
Directory
Directory preface software Environment Knowledge Subprocess Popen Constructor constructor Class Popen parameter args calling program call shell instruction Stdinstdoutstderr real-time fetch subroutine output one time get all output of
This article describes how to modify the registry of python to terminate the 360 process instance. it is a very practical process operation technique, for more information about how to modify the registry and terminate the 360 process in python, see
Python provides multiple modules for creating sub-processes. I prefer to use the subprocess module because the python manual contains the following:
This module intends to replace several other, older modules and functions, such as: OS. System, OS.
This example describes how Python modifies the registry to terminate the 360 process. Share to everyone for your reference.
The specific implementation code is as follows:
Import _winregimport osimport shutil# copy itself Shutil.copyfile
1.2. Popen ObjectsAn instance of the Popen class has the following methods:1. Popen.poll ()Checks whether the child process has ended, sets and returns the return code value.2. Popen.wait ()Waits for the child process to end, sets and returns the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.