Skip to content

Instantly share code, notes, and snippets.

@davidnvq
Created April 19, 2019 15:18
Show Gist options
  • Save davidnvq/54ffc50869d7864c31e22377fd18d980 to your computer and use it in GitHub Desktop.
Save davidnvq/54ffc50869d7864c31e22377fd18d980 to your computer and use it in GitHub Desktop.
Parse with list
import argparse
parser.add_argument(
"--list",
nargs="+",
help="This will accept the list of values or a single value",
default=['1']
)
args = parser.parse_args()
# >> parser.py --list 1 2 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment