HOME BLOG

How to run system commands in Python and get the output

Posted on: April 20th, 2020 by Olu No Comments

Hi folks,

Here is an easy way to run system commands in Python and get the output. It is by using subprocess.getoutput command. E.g.

import subprocess
output = subprocess.getoutput("ls -l ~")
print(output)

 

That’s all for now. Till next time, happy software development.

Leave a Reply