Last active
December 19, 2015 11:19
-
-
Save seekshreyas/5947254 to your computer and use it in GitHub Desktop.
Scaffolding for my Python programs
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/python | |
| """ Program Aim | |
| More description about the program | |
| """ | |
| __author__ = "@Name" | |
| __email__ = "@Email" | |
| __python_version = "Python 2.7.3 -- EPD 7.3-2 (32-bit)" | |
| from optparse import OptionParser | |
| def getInput(): | |
| parser = OptionParser() | |
| parser.add_option('-d', '--dir', dest='dirpath') | |
| parser.add_option('-t', '--type', dest='filetype', default='xml') | |
| (option, args) = parser.parse_args() | |
| if not option.dirpath: | |
| return parser.error('directory path not given. User --dir="path.to.directory" for file statistics') | |
| return {'dir': option.dirpath, 'type': option.filetype} | |
| def main(): | |
| userInput = getInput() | |
| print userInput['dir'], userInput['type'] | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment