Skip to content

Instantly share code, notes, and snippets.

@nloadholtes
Created December 31, 2017 22:01
Show Gist options
  • Save nloadholtes/07fd85eca1d39a9cd78264bfbf9ad5b2 to your computer and use it in GitHub Desktop.
Save nloadholtes/07fd85eca1d39a9cd78264bfbf9ad5b2 to your computer and use it in GitHub Desktop.
Example of using argparse with dashes in the variable names
import argparse
def copyfiles(src, dest):
print("Copying from %s to %s" % (src, dest))
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("src_dir", metavar="src-dir", help="Where we are copying from")
parser.add_argument("dest_dir", metavar="dest-dir", help="Where we are copying to")
settings = parser.parse_args()
copyfiles(settings.src_dir, settings.dest_dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment