Skip to content

Instantly share code, notes, and snippets.

@sparkstar
Created July 25, 2014 18:01
Show Gist options
  • Save sparkstar/1ec173ededd2972b4f00 to your computer and use it in GitHub Desktop.
Save sparkstar/1ec173ededd2972b4f00 to your computer and use it in GitHub Desktop.
basic template of python script from 'How to Write "Pythonic" Code'
#!/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