subprocess
The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several older modules and functions:
os.system
os.spawn*
code:python
code:python
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=False)
print 'return: %d' % (p.wait(), )
print 'stdout: %s' % (p.stdout.readlines(), )
print 'stderr: %s' % (p.stderr.readlines(), )
python - subprocess wildcard usage - Stack Overflow
Tips
How To Abstract SSH Commands in Python
Bash vs. Python vs. JavaScript: Which Is Better for Automation? | by Shalitha Suranga | Oct, 2021 | Better Programming
check output
code:pyhon
import subprocess
print('You are using Node ' + o)