3 ms·
Nothing stops you from calling bash from Python to combine bash pipelines (onelines) but if you must use Python for some reason, to run `baz` for each line in
by d0mine 4y ago
Nothing stops you from calling bash from Python to combine bash pipelines (onelines) but if you must use Python for some reason, to run `baz` for each line in `foo` & `bar` output:
from subprocess import Popen, PIPE, run
with Popen('foo', stdout=PIPE) as foo, Popen('bar', stdout=PIPE) as bar:
for f, b in zip(foo.stdout, bar.stdout):
run(['baz', f, b])
(there is a slight difference in behaviour)