Python argparse argument with quotes

argparse, optparse, python

Solution

I think it is the shell that eats them, so python will actually never see them. Escaping them on the command line may be your only option.

If it's the `\"backslash\"` style escaping you don't like for some reason, then this way should work instead:

pbsnodes -x | xmlparse -t '"interactive-00"'

Problem

Is there any way I can tell argparse to not eat quotation marks? For example, When I give an argument with quotes, argparse only takes what's inside of the quotes as the argument. I want to capture the quotation marks as well (without having to escape them on the command line.) ``` pbsnodes -x | xmlparse -t "interactive-00" ``` produces ``` interactive-00 ``` I want ``` "interactive-00" ```

Original source