store_true 是指带触发action时为真,不触发则为假, 代码去掉default初始化,其功能也不会变化
parser.add_argument('-c', action='store_true')
# 或者parser.add_argument('-c', action='store_true', default=false)
#python test.py -c => c是true(触发)
#python test.py => c是false(无触发)
store_true 是指带触发action时为真,不触发则为假, 代码去掉default初始化,其功能也不会变化
parser.add_argument('-c', action='store_true')
# 或者parser.add_argument('-c', action='store_true', default=false)
#python test.py -c => c是true(触发)
#python test.py => c是false(无触发)
相关文章: