SoFunction
Updated on 2024-12-10

Example of python capturing the output of a shell script

import subprocess
output =Popen(["mycmd","myarg"], stdout=PIPE).communicate()[0]


import subprocess
p = (['ls','-a'], stdout=, stderr=)
out, err = ()
print out

 

# work on Unix/Linux only

import commands
print ('wc -l file')[1]

Above is the python capture the output of the shell script for everyone to bring the example of all the content, I hope you more support me ~!