Calling Bash Command From Python

Random832 random832 at fastmail.com
Mon Oct 31 11:05:23 EDT 2016


On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote:
> I have code using that approach but I am trying to save myself
> from having to parse the entire shadow file.  Grep will do it
> for me if I can get code right.

Python already has built-in functions to parse the shadow file.

https://docs.python.org/3/library/spwd.html#module-spwd

But you can't use sudo this way if you use that. But why do you want to
use sudo from within the python script instead of just running the
python script with sudo?



More information about the Python-list mailing list