[Tutor] ArgumentParser - Command Line arguments
Mats Wichmann
mats at wichmann.us
Wed Nov 20 09:50:23 EST 2019
sorry, I made some thinkos when retyping these bits (no coffee yet :) ),
just take the ideas, not the literal typing....
> parser.add_argument("file1", type=str, help='Input for sqlinvocation.log')
> parser.add_argument("--file2", nargs=1, help='patch file')
>
> now you can run as all of these and it should work out:
>
> python script.py somefilename
> python script.py --patch=patchfilename somefilename
> python script.py somefilename --patch=patchfilename
More information about the Tutor
mailing list