Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85735 > unrolled thread

RE: A question about a list and subprocess.check_call()

Started byDavid Aldrich <David.Aldrich@EMEA.NEC.COM>
First post2015-02-17 09:32 +0000
Last post2015-02-17 09:32 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: A question about a list and subprocess.check_call() David Aldrich <David.Aldrich@EMEA.NEC.COM> - 2015-02-17 09:32 +0000

#85735 — RE: A question about a list and subprocess.check_call()

FromDavid Aldrich <David.Aldrich@EMEA.NEC.COM>
Date2015-02-17 09:32 +0000
SubjectRE: A question about a list and subprocess.check_call()
Message-ID<mailman.18782.1424165529.18130.python-list@python.org>
>It's also possible to do it the other around using shlex.split. I prefer that version because 
>I can easily copy/paste the command from code to the shell, it's also more readable IMO:

> cmd = """python3 -O -c "import sys; print(sys.argv[1:])" foo bar "spam egg" """
> print(cmd)
> subprocess.check_call(shlex.split(cmd))

Thanks again for the replies to my question.  I especially like the solution of using shlex.split().
 

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web