Skip to content

Instantly share code, notes, and snippets.

@h3nryza
Created July 17, 2018 16:41
Show Gist options
  • Save h3nryza/c2dcb5acd0b444cbe90d960b04924939 to your computer and use it in GitHub Desktop.
Save h3nryza/c2dcb5acd0b444cbe90d960b04924939 to your computer and use it in GitHub Desktop.
Argparse example
#!/usr/bin/python
# -*- coding: <utf-8> -*-
from __future__ import print_function
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Description of what this does')
parser.add_argument("-c", "--configfile", dest="conf", help="Config file for something")
parser.add_argument("-f", "--flag", dest="bolFlag", action="store_true", help="Marks True if flag is used")
args = parser.parse_args()
if args.bolFlag == True:
"do something
else:
"do something"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment