43 ms·
I don't think the piping syntax is a big issue. If you use it more than once in a module, just define something like this: (haven't checked, may have errors)
by viraptor 11y ago
I don't think the piping syntax is a big issue. If you use it more than once in a module, just define something like this: (haven't checked, may have errors)
def pipe_them(args*):
last = subprocess.Popen(args[0], stdout=subprocess.PIPE)
for p in args[1:]:
last = subprocess.Popen(p, stdin=last.stdout, stdout=subprocess.PIPE)
return last
proc = pipe_them(['something'], ['something_else', 'args'], ['final_one'])
proc.communicate()
Interpolation shouldn't be a huge problem either with `% locals()` (if it's a small one-off script).