I am trying to parse date as an argument in Python with argparse:
def parsing(parser):
parser.add_argument("--b", type=str)
parser.add_argument("--e", type=str)
return parser
parser = argparse.ArgumentParser()
parser = parsing(parser)
args = parser.parse_args()
I'm trying to execute it with:
python file.py –-b 20100101 –-e 20200120
But I am getting a "unrecognized argument" error. I have also tried removing the type=str, but I get the same error.
C:\Users\user\miniconda3\lib\site-packages\numpy_distributor_init.py:30: UserWarning: loaded more than 1 DLL from .libs:
C:\Users\user\miniconda3\lib\site-packages\numpy\.libs\libopenblas.PYQHXLVVQ7VESDPUVUADXEVJOBGHJPAY.gfortran-win_amd64.dll
C:\Users\user\miniconda3\lib\site-packages\numpy\.libs\libopenblas.WCDJNK7YVMPZQ2ME2ZZHJJRJ3JIKNDB7.gfortran-win_amd64.dll warnings.warn("loaded more than 1 DLL from .libs:" usage: file.py [-h] [--b B] [--e E] file.py: error: unrecognized arguments: –-b 20100101 –-e 20200120
python file.py "--b 20100101 --e 20200120"dashis most obvious in your comments as displayed on my tablet. With other fonts there's just a slight difference in character length.