The sys.argv
is all Python got. The shell processed the filename generation (globs), parameter (variable) expansion, quotes, and word splitting before passing the arguments to the Python process (in Unix; in Windows it's the startup actually parsing it, but for portability, you can't rely on that).
However, remember that POSIX shell quoting rules allow passing any characters you may want (except NUL bytes that terminate strings).
Compare starting a process from Python using subprocess.call with or without the shell
argument set. With shell=False
the list of strings is what comes up in the sys.argv
in the started process (starting with the script path; parameters processed by Python itself are removed) while with shell=True
the string is passed to the shell which interprets it according to its own rules.