Posts

Showing posts with the label Python(subprocess)

How to run an external script in Python

Image
  Python offers a subprocess module for you to run external script, which is more flexible than its os.system() function. It provides more powerful facilities for spawning new processes and retrieving their results. For instance, import subprocess subprocess.run(["ls", "-l"]) or for versions before Python 3.5, use the following: import subprocess subprocess.call(["ls", "-l"])