Skip to content

Instantly share code, notes, and snippets.

@ymcdull
Created April 14, 2016 14:55
Show Gist options
  • Save ymcdull/abeee177a9f5deaea094dd42bd471499 to your computer and use it in GitHub Desktop.
Save ymcdull/abeee177a9f5deaea094dd42bd471499 to your computer and use it in GitHub Desktop.
Test optparser example
### optparser has been discarded since python2.7, try argparse instead
### Url: http://lingxiankong.github.io/blog/2014/01/14/command-line-parser/
from optparser import OptionParser
parser = OptionParser()
parser.add_option('-f', '--file', dest="filename", help="write report to FILE", metavar="FILE")
options, args = parser.parse_args()
print options, args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment