【发布时间】:2014-11-03 12:59:34
【问题描述】:
我有以下两个参数要指定:
parser.add_argument("-s", "-server", help="specify the server", required=True)
parser.add_argument("-pw", "-password", help="Provide your Admin Password", required=True)
这很好用,只是我的首选“测试”/虚拟密码发现了一些问题。
我的虚拟密码是90opl;./
如果我运行./test.py -s testserver -pw 90opl;./
我收到一个错误,因为它没有将 90opl;./ 解释为 ' 90opl;,./ '
所以身份验证失败,然后-bash 说./: Is a directory(密码结束)。
要解决这个问题,我必须运行 ./test.py -s testserver -pw '90opl;./' - 也就是必须使用单引号。
有没有办法解决这个问题?
我似乎无法在网上找到答案。我试过指定type=str 无济于事。
很抱歉,如果这有一个明显的修复,但我有点像 python 菜鸟。
【问题讨论】: