Skip to content

Instantly share code, notes, and snippets.

@mojaveazure
Last active December 11, 2015 23:21
Show Gist options
  • Save mojaveazure/7ac575307174ffb85696 to your computer and use it in GitHub Desktop.
Save mojaveazure/7ac575307174ffb85696 to your computer and use it in GitHub Desktop.
An example of a switch argument in Python
#!/usr/bin/env python
import argparse
parser = argparse.ArgumentParser(add_help=True, description="A switch argument in Python")
parser.add_argument('-s',
'--switch',
help="The switch",
action='store_true',
required=False,
default=False)
print(parser.parse_args())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment