On this page
  1. subprocess.getoutput
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

subprocess.getoutput

Prev: subprocess.CompletedProcess | Up: subprocess | Next: subprocess.getstatusoutput
Rel: subprocess.call, subprocess.CalledProcessError, subprocess.check_call, subprocess.check_output
Ref: docs.python.org — subprocess.getoutput
Tags: #public #python3 #stdlib #subprocess


Import

import subprocess
from subprocess import getoutput

Signature & Overview

subprocess.getoutput(cmd, *, encoding=None, errors=None)

Return output (stdout or stderr) of executing cmd in a shell.

Usage

import subprocess

out = subprocess.getoutput("echo hello")
assert out == "hello"

Gotchas

REPL Inspect

from subprocess import getoutput
help(getoutput)

Linked from

Related notes