shlex.split != shlex.shlex get_token til eof

p.lavarre at ieee.org p.lavarre at ieee.org
Mon Sep 25 22:34:58 EDT 2006


> I see shlex.split gives me what I want ...
> shlex.shlex surprisingly gives me something else ...
> I can get closer ... by hacking ...
> .wordchars += ".+-"

Kindly offline I was told,

Try patching .whitespace_split = True instead.  Compare:

shlex.split("//./PhysicalDrive9 //./Cdrom9 //./Tape9 //./A:")

lex = shlex.shlex("//./PhysicalDrive9 //./Cdrom9 //./Tape9 //./A:")
lex.whitespace_split = True
list(lex)

Why and how often this patch makes shlex.shlex and shlex.split agree, I
still don't know - but for these specific examples, it works.




More information about the Python-list mailing list