Skip to content

Instantly share code, notes, and snippets.

@kccheung kccheung/

forked from n8henrie/
Created Apr 30, 2018
What would you like to do?
Python script template
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
A simple python script template.
import argparse
def main(qux, foo=1, bar=2):
"""Main script where stuff happens."""
print("Foo: {}\nBar: {}\nQux: {}".format(foo, bar, qux))
def _cli():
parser = argparse.ArgumentParser(
parser.add_argument('-f', '--foo', help="This is the foo argument")
parser.add_argument('-b', '--bar', help="This is the bar argument")
qux_help = ("This argument will show its default in the help due to "
parser.add_argument('-q', '--qux', default=3, help=qux_help)
args = parser.parse_args()
return vars(args)
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.