values within quotes

Guyon Morée gumuz at looze.net
Mon Mar 22 05:18:08 EST 2004


Hi all,

I looked on the web for this, but I couldn't find it.

I give my program commands like this: GET MODLIST

This is very easy to parse, I can just use .split() to because it has only
spaces to seperate the different parts of the command. Now I want, for
example, the following command: GET FILE C:\my docs\my file.txt. Obviously I
cannot use .split() for this one, because it uses spaces in the filename.
Common pc knowledge tells me that I should put the 'space-value' witin
quotes like: GET FILE "C:\my docs\my file.txt".

So the big question is: What is the best way to parse such a string?

kind regards,

Guyon





More information about the Python-list mailing list