Last active
October 26, 2016 16:37
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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