Skip to content

Instantly share code, notes, and snippets.

@andychase
Last active December 24, 2015 04:49
Show Gist options
  • Save andychase/6746719 to your computer and use it in GitHub Desktop.
Save andychase/6746719 to your computer and use it in GitHub Desktop.
Minimal Python command line argument processing
#!python
""" A fairly simple way of parsing arguments without using libraries.
Licenced: http://creativecommons.org/publicdomain/zero/1.0/
"""
import sys
def main(_=None, argument_1="", argument_2="", *args):
if not argument_1:
print("need arg 1!)"
# etc.
if __name__ == "__main__":
main(*sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment