3 ms·
So that's ls Two characters instead of 3 lines Where's grep ? And where's the pipe ?
by ur-whale 3y ago
So that's ls
Two characters instead of 3 lines
Where's grep ?
And where's the pipe ?
- d0mine 3y agoglob plays grep's role here. No need for a pipe. If you want to run a shell pipeline that is more challenging to port to pure Python, then you could the shell directly: S.run("a | b", shell=True) You could emulate it in Python using the subprocess module but it would be more verbose. It depends on specific use-case whether it is worth the trouble. Calling the shell pipeline from Python gets you the best of both worlds: a shell one liner is used as a concise domain specific language to run commands , and more complex logic, proper error handling, etc is left to Python.