Best way to rewrite Popen

Cecil Westerhof Cecil at decebal.nl
Tue May 19 13:01:05 EDT 2015


At the moment I am playing with things like:
    p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE)

I think that most of the times this are the values I want. So it would
be nice to overrule the defaults. What is the best way to do this? So
creating a function that is exactly the same except for the defaults
for shell and stdout (and maybe stderr).


It is a little less important as I first thought, because I found the
following:
    error, output = subprocess.getstatusoutput('ls -1')
    files_new = output.splitlines()
But it is still nice to know.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list