Skip to content

Instantly share code, notes, and snippets.

@simplue
Created November 14, 2018 05:04
Show Gist options
  • Select an option

  • Save simplue/7d3218d3ab466b6d316772e768463ceb to your computer and use it in GitHub Desktop.

Select an option

Save simplue/7d3218d3ab466b6d316772e768463ceb to your computer and use it in GitHub Desktop.
# argparse module How to add option without any argument?
# https://stackoverflow.com/questions/5262702/argparse-module-how-to-add-option-without-any-argument
from argparse import ArgumentParser
p = ArgumentParser()
_ = p.add_argument('-f', '--foo', action='store_true')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment