Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我$在参数中使用符号,python optparse则无法正确解析它。它只是忽略符号和下一个字符。如果我\之前给出,$那么它工作正常。但我不想给\. 请帮助我如何克服这种情况。
$
python optparse
\
它只发生在 Linux 中;在 Windows 上它工作正常。
提前感谢您的帮助。
我认为这是因为 Linux 使用 $ 来识别 shell 变量。
所以,如果你想在你的参数中使用这个符号,你唯一的机会是传递 '\$',它不会被调用 shell 替换。Windows 使用 %variablename% 来识别那种变量,这就是为什么你不会在那个操作系统上遇到这种“问题”