PyDocs

Nav

Concurrent Execution

getoutput

subprocess

function (source) UnixWindows
  • getoutput(cmd, *, encoding=None, errors=None)
Return output (stdout or stderr) of executing cmd in a shell.

Like getstatusoutput(), except the exit status is ignored and the return
value is a string containing the command's output.  Example:

>>> import subprocess
>>> subprocess.getoutput('ls /bin/ls')
'/bin/ls'
Changed in 3.3.4, 3.11
  • 3.3.4: Windows support added
  • 3.11: Added the encoding and errors parameters.
1 Example
>>> subprocess.getoutput('ls /bin/ls')
'/bin/ls'
from the Python docs
See Also
No see-alsos for subprocess/getoutput
0 Notes
No notes for getoutput