Difference between revisions of "Argparse"
Jump to navigation
Jump to search
(10 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
* https://docs.python.org/3/library/argparse.html | * https://docs.python.org/3/library/argparse.html | ||
− | + | * Action: https://docs.python.org/3/library/argparse.html#action | |
+ | store_true | ||
+ | |||
+ | |||
[[import argparse]] | [[import argparse]] | ||
+ | parser = [[argparse.ArgumentParser]] (allow_abbrev=False, usage=usage()) | ||
− | + | parser.add_argument("your_argument") | |
+ | args = parser.parse_args() | ||
+ | == Related == | ||
+ | * <code>[[optparse]] (deprecated)</code> | ||
+ | * <code>[[import sys]]</code> | ||
== See also == | == See also == | ||
+ | * {{import}} | ||
* {{argparse}} | * {{argparse}} | ||
− | |||
[[Category:Python]] | [[Category:Python]] |
Latest revision as of 12:17, 27 March 2024
store_true
import argparse parser = argparse.ArgumentParser (allow_abbrev=False, usage=usage())
parser.add_argument("your_argument") args = parser.parse_args()
Related[edit]
optparse (deprecated)
import sys
See also[edit]
Advertising: