The first and the most straight forward approach to run a shell command is by using os.system():
- import os os. system('ls -l')
- import os stream = os. ...
- import subprocess process = subprocess. ...
- with open('test.txt', 'w') as f: process = subprocess. ...
- import shlex shlex. ...
- process = subprocess. ...
- process.