June 2019
Beginner to intermediate
770 pages
19h 24m
English
We define positional arguments using a name with no "-" decoration. In a case where we have a fixed number of positional arguments, we'll add them appropriately to the parser, as shown in the following code:
parser.add_argument("input_filename", action="store")
parser.add_argument("output_filename", action="store")
When parsing argument values, the two positional argument strings will be stored in the final namespace object. We can use config.input_filename and config.output_filename to work with these argument values.
As noted previously, using simple positional parameters to identify output files can cause problems for users. The GNU/Linux cp, mv, and ln programs should be considered exceptional cases where a file ...
Read now
Unlock full access