0

I have a simple code that passes arguments in python as below

parser = argparse.ArgumentParser(description='Processing data')
parser.add_argument("-number" , required=True)
args = parser_args()

print('Hi your number is: ' + args.number)

so if I do python main.py -number 1234 it will print it for me.

What I want to do is if I add any other arguments like python main.py -blah -number 1234 I want to get the same result as before but right now it is showing me an error saying 'unrecognized arguments: -blah'

0 Answers0