Skip to content
Snippets Groups Projects
Commit 12456064 authored by xiamengzhou's avatar xiamengzhou
Browse files

update

parent 660680ce
Branches
No related tags found
No related merge requests found
import argparse
# Create the parser
parser = argparse.ArgumentParser(description="Example script.")
# Add the argument
# The '+' sign means "one or more".
# The parser will expect at least one value, and all values will be gathered into a list.
parser.add_argument("--mylist", nargs='+', type=int, help="A list of integer values", default=[1, 2, 3])
parser.add_argument("--mylist2", type=int, help="A list of integer values", default=2)
# Parse the arguments
args = parser.parse_args()
# Access the argument values (which will be a list)
print(args.mylist)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment