From d3e2e93712e3a3a9da459973afd3eda76ffa948e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 24 Feb 2019 05:38:04 +0100 Subject: [PATCH] Command line arguments --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0c9b2c2..da94875 100644 --- a/README.md +++ b/README.md @@ -1018,13 +1018,13 @@ arguments = sys.argv[1:] ### Argparse ```python from argparse import ArgumentParser, FileType - = ArgumentParser(description=) -.add_argument('-', '--', action='store_true') # Flag -.add_argument('-', '--', type=) # Option -.add_argument('', type=, nargs=1) # First argument -.add_argument('', type=, nargs='+') # Remaining arguments - = .parse_args() -value = . +p = ArgumentParser(description=) +p.add_argument('-', '--', action='store_true') # Flag +p.add_argument('-', '--', type=) # Option +p.add_argument('', type=, nargs=1) # Argument +p.add_argument('', type=, nargs='+') # Arguments +args = p.parse_args() +value = args. ``` * **Use `'help='` for argument description.**