我有一个python 2.7的程序,里面有一行代码:
parser.add_argument('--skip_train', default=False, help='skip training', action='store_true')
此代码告诉程序默认运行训练。但是现在我想在没有培训的情况下实现它,因为培训已经完成。所以我在提示中输入:
python myprogame.py --skip_train True
但这会给出错误信息:
error: unrecognized arguments: True
在提示命令中应该输入什么来实现程序?
最佳答案
当您使用 action='store_true'
时,您不应为 --skip_train
选项提供值。只是做:
python myprogame.py --skip_train
关于python - 解析器.add_argument : error: unrecognized arguments: True,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45009683/