Eric V. Smith added the comment:
I agree that the current behavior makes sense. I think "preserve the literal
value of the next character" means the space won't be interpreted as a
separator.
In the first example (I think better written as shlex.split(r'a \ b')), the
first space is a separa
Peter Otten <__pete...@web.de> added the comment:
To me the current shlex behaviour makes sense, and the shell (tested with bash)
behaves the same way:
$ python3 -c 'import sys; print(sys.argv)' a b
['-c', 'a', 'b']
$ python3 -c 'import sys; print(sys.argv)' a \ b
['-c', 'a', ' ', 'b']
---
New submission from Max :
I believe in both cases below, the ouptu should be ['a', 'b']; the extra ' '
inserted in the list is incorrect:
python3.6
Python 3.6.2 (default, Aug 4 2017, 14:35:04)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.