argparse_notes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
argparse_notes [2024/02/12 22:02] – raju | argparse_notes [2024/02/12 22:18] (current) – raju | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== --feature and --no-feature ==== | ==== --feature and --no-feature ==== | ||
+ | To do | ||
+ | < | ||
+ | command --feature | ||
+ | </ | ||
+ | and | ||
+ | < | ||
+ | command --no-feature | ||
+ | </ | ||
+ | |||
+ | For python >= 3.9: | ||
+ | < | ||
+ | parser.add_argument(' | ||
+ | </ | ||
+ | |||
+ | For python < 3.9: | ||
+ | < | ||
+ | parser.add_argument(' | ||
+ | parser.add_argument(' | ||
+ | parser.set_defaults(feature=True) | ||
+ | </ | ||
+ | |||
+ | In practice: | ||
< | < | ||
parser.add_argument( | parser.add_argument( | ||
Line 11: | Line 33: | ||
parser.set_defaults(header=True) | parser.set_defaults(header=True) | ||
</ | </ | ||
+ | |||
+ | Ref:- | ||
+ | * https:// | ||
+ | * https:// | ||
+ |
argparse_notes.1707775350.txt.gz · Last modified: 2024/02/12 22:02 by raju