4 ms·
Is there an elegant way to do unix-like piping in python?
by ducktective 6y ago
Is there an elegant way to do unix-like piping in python?
- d0mine 6y ago- use shell=True and subprocess module i.e., use sh for what it is good for (one-liners that run external commands) and use python to glue it together in a sane manner (consider shell as a DSL in this case). - you could use the plumbum module to embed commands in Python itself https://plumbum.readthedocs.io/en/latest/#piping https://plumbum.readthedocs.io/en/latest/#piping - for Makefile-like functionality invoke/fab could be used (flexible configuration, composition, debugging of the commands) https://docs.fabfile.org/en/2.6/getting-started.html#addendum-the-fab-command-line-tool https://docs.fabfile.org/en/2.6/getting-started.html#addendu...