Created
July 25, 2014 18:01
-
-
Save sparkstar/1ec173ededd2972b4f00 to your computer and use it in GitHub Desktop.
basic template of python script from 'How to Write "Pythonic" Code'
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 | |
# examples/script-template.py | |
def main(args): | |
if not args: | |
print "Usage: foo ARG1 [ARG2...]" | |
return 2 | |
return 0 | |
if __name__ == '__main__': | |
import sys | |
status = main(sys.argv[1:]) | |
sys.exit(status) | |
# or combined | |
# sys.exit(main(sys.argv[1:])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment