Calling an external command from Python

Use the subprocess module

For Python versions before 3.5:

import subprocess
subprocess.call(["ls", "-l"])

For Python 3.5 and above:

import subprocess
subprocess.run(["ls", "-l"])