Skip to content

Instantly share code, notes, and snippets.

@fwindpeak
Created June 27, 2017 03:05
Show Gist options
  • Select an option

  • Save fwindpeak/303e932a51009717e3b18d79e79b8073 to your computer and use it in GitHub Desktop.

Select an option

Save fwindpeak/303e932a51009717e3b18d79e79b8073 to your computer and use it in GitHub Desktop.
getopt example
#!/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