Python argparse argument with quotes

后端 未结 2 1066
一向
一向 2021-01-12 02:04

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 a

2条回答
  •  有刺的猬
    2021-01-12 02:55

    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"'
    

提交回复
热议问题