Created
June 27, 2017 03:05
-
-
Save fwindpeak/303e932a51009717e3b18d79e79b8073 to your computer and use it in GitHub Desktop.
getopt example
This file contains hidden or 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
| #!/usr/bin/env python | |
| import sys,getopt | |
| opts,args = getopt.getopt(sys.argv[1:],"s:e:h",["start_time","end_time","help"]) | |
| start_time='' | |
| end_time='' | |
| for op,value in opts: | |
| if op == '-s': | |
| start_time = value | |
| elif op == '-e': | |
| end_time = value | |
| elif op == '-h': | |
| print 'help' | |
| sys.exit(0) | |
| print "start_time={start_time}\nend_time={end_time}".format(start_time=start_time,end_time=end_time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment