Skip to content

Instantly share code, notes, and snippets.

@MagerValp
Created February 27, 2017 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MagerValp/9fc82104e0528086e5c49edb5746ecb7 to your computer and use it in GitHub Desktop.
Save MagerValp/9fc82104e0528086e5c49edb5746ecb7 to your computer and use it in GitHub Desktop.
Python 2 template
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import io
import sys
import codecs
if sys.stdout.encoding != "UTF-8":
sys.stdout = codecs.getwriter("utf-8")(sys.stdout, "strict")
if sys.stderr.encoding != "UTF-8":
sys.stderr = codecs.getwriter("utf-8")(sys.stderr, "strict")
import argparse
def main(argv):
p = argparse.ArgumentParser()
p.add_argument("-v", "--verbose", action="store_true",
help="Verbose output.")
args = p.parse_args([x.decode("utf-8") for x in argv[1:]])
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment