>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(). -- https://mail.python.org/mailman/listinfo/python-list