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(无触发)

  

 

相关文章:

  • 2022-02-07
  • 2022-01-09
  • 2021-06-09
  • 2021-09-29
  • 2021-09-13
  • 2022-01-31
猜你喜欢
  • 1970-01-01
  • 2023-02-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-12-10
  • 2022-12-23
相关资源
相似解决方案