New course! Every coder should learn Generative AI!
Try a free lesson+ 5
The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function [os.system()].Example:
import subprocess
subprocess.run(["pip3", "list"])
using subprocess.call () you can’t actually provide any arguments in line a - just the literal name of the executable file.Example:
import subprocess
subprocess.call(['ls', '-l'])