subprocess.run(args, capture_output=True, check=True, text=True,
encoding="utf8").stdout ?

On Thu, 26 Aug 2021, 13:55 Evan Greenup via Python-ideas, <
[email protected]> wrote:

> Currently, when what to execute external command, either os.system() or
> subprocess functions should be invoked.
>
> However, it is not so convenient, it would be nice to use "``" symbol to
> brace the shell command inside.
>
> like:
>
> stdout_result_str = `cat file.txt | sort | grep hello`
>
> Its is enhanced feature which combine both subprocess and os.system
>
> Because, subprocess can return output of file, but does not support pipe
> in command.
>
> While os.system can apply pipe in command but doesn't support return
> stdout result.
>
> This can be very convenient to make python available for some build script
> which ruby now do well like homebrew ...
>
> simply
>
> `echo hello | wc -l` while only execute command and the result will just
> like other unassigned expression, the result will be finally discarded.
>
> There won't be big difficulties to implement.
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/5KKHG6TLBLI46XBPSOBU7FTL5TB57EIC/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/QFMX6LVUNYQ2E537B2ZJTHQXOISCCLLO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to