Skip to content

Instantly share code, notes, and snippets.

@jmquintana79
Last active February 19, 2018 08:56
Show Gist options
  • Save jmquintana79/9224cbf63e66c85e838a to your computer and use it in GitHub Desktop.
Save jmquintana79/9224cbf63e66c85e838a to your computer and use it in GitHub Desktop.
parse python script arguments
import argparse
# Functions here
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Create Marketing Report')
parser.add_argument('--accounts',
action='store_true',
help='Process Account Data')
parser.add_argument('--sales',
action='store_true',
help='Process Sales Data')
args = parser.parse_args()
# Process accounts
if args.accounts:
# Do something
# Process sales
if args.sales:
# Do Something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment