Python Subprocess - CameronAuler/python-devops GitHub Wiki

subprocess.run()

The subprocess.run() function passes a system command to the system. The required keyword arguments include shell which determines if the command is passed through the command shell(CMD) or not. The code for running a basic command is shown below.

put.py Code:

import subprocess

subprocess.run("echo Hello", shell=True)

Output:

PS C:\Users\CM8817\Github\CSDEV.py\Code\Subprocess> python sub.py
Hello

Resources