Created
September 15, 2017 21:23
-
-
Save nloadholtes/472152456270a9b31768ef8554b30b78 to your computer and use it in GitHub Desktop.
How to get argparse to use dashes in positional arguments
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 | |
parser = argparse.ArgumentParser() | |
parser.add_argument("table_name", metavar="table-name", help="blah", default=None) | |
parser.add_argument("--start-ts", help="blah2", default=None) | |
settings = parser.parse_args() | |
import pdb; pdb.set_trace() | |
print("goodbye") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output is:
Argparse turns argument names with hyphens into underscores as in --start-ts => start_ts