Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

argparse option for passing a list as option

Asked by Yajaira Satchell Jun 8, 2021 2.3K views 1 answer
Share

About this question

I am trying to pass a list as an argument to a command-line program. Is there an argparse option to pass a list as option? 


parser.add_argument('-l', '--list',
type=list, action='store',
dest='list',
help=' Set flag',
required=True)

The script is called like below

python test.py -l "265340 268738 270774 270817"


Your answer

1 Answer

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.