Created
December 31, 2017 22:01
-
-
Save nloadholtes/07fd85eca1d39a9cd78264bfbf9ad5b2 to your computer and use it in GitHub Desktop.
Example of using argparse with dashes in the variable names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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