Created
June 12, 2012 20:39
-
-
Save solomon081/2919982 to your computer and use it in GitHub Desktop.
SetOpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getopt | |
import sys | |
version = "1.0" | |
verbose = False | |
output = "default.out" | |
try: | |
options, remainder = getopt.getopt(sys.argv[1:], "o:v", ["output=", "verbose=", "version="]) | |
except Exception as err: | |
print(err) | |
sys.exit(1) | |
for opt, arg in options: | |
if opt in ("-o", "--output"): | |
output_filename = arg | |
elif opt in("-v", "--verbose"): | |
verbose = True | |
elif opt == "--version": | |
version = arg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment