Skip to content

Instantly share code, notes, and snippets.

@bast
Last active October 26, 2016 16:37
Show Gist options
  • Save bast/ff08e970042775d4af939bd27789fa54 to your computer and use it in GitHub Desktop.
Save bast/ff08e970042775d4af939bd27789fa54 to your computer and use it in GitHub Desktop.
Example with check_output: uses output from a command and splits it into a list.
from subprocess import check_output
# extract output
out = check_output('grep -l foo *', shell=True).decode("utf-8")
# split into a list
l = out.split('\n')
# print the list
print(l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment