I have the following piece of code:
def parse_args():
"""Takes in arguments from command when run
:return: date
"""
parser = argparse.ArgumentParser(sys.argv)
parser.add_argument('-d')
args = parser.parse_args()
d_param = args.d
if d_param is None:
d_param = datetime.today().date() - BDay(1)
else:
d_param = datetime.strptime(d_param, "%Y%m%d")
d_param = d_param.date()
return d_param
So currently it only takes the one date parameter. For e.g:
script.py -d 20210110
How can I pass a date range? Like if I want the script to run from lets say 1st of January to 10th of January. So basically 20210101 to 20210110. Is it possible to give an option of either a date range or one date?
P.S- Currently I am using the date in the script to calculate some field.