TECHIES WORLD

For Techs.... Techniques.... Technologies....

LinuxPython

Execute shell script from Python

Os module provides the function to execute shell script from Python.

import os
os.popen("command")

Here we need to replace "command" with the name of the command.

If we need to suppress the printing of output, use the following format.

import os
os.popen("command").read()  #read for suppressing output

 

Leave a Reply