python | Argparse中action的可选参数store_true,store_false到底是什么意思?


store_true 是指带触发action时为真,不触发则为假

例如:

parser.add_argument('-c', action='store_true')

#python test.py -c => c是true(触发)
#python test.py => c是false(无触发)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM