ReGAT项目---Parser---argument中的store_true

parser.add_argument('--tfidf', action='store_true',
                        help='tfidf word embedding?')

action=‘store_true’ 是一个触发操作
当触发时,所设置参数为True;
不触发时,所设置参数为False;
如下:

python run.py --tfidf

此时 运行代码中包含–tfidf参数 故触发 所以tfidf == True

python run.py

此时 运行代码中不包含–tfidf参数 故触发 所以tfidf == False

store_false 和store_true一样道理
注:
若代码中设置了default,则不加参数运行的时候,参数值==default

另,附上一篇较完整的Argument中的参数介绍博客
argparse - 命令行选项与参数解析

你可能感兴趣的:(报错,python,计算机视觉,深度学习)