Answer the question
In order to leave comments, you need to log in
How to get rid of the quotes around the list?
import argparse
clients_ids = []
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--ids', action='store', nargs='+', dest='cids', help='client_ids for sending. Example: -i=1,2,3')
arguments = parser.parse_args()
clients_ids = arguments.cids
print(clients_ids)
print(type(clients_ids))
python3 app.py -i=155,2,3
['155,2,3']
<class 'list'>
Answer the question
In order to leave comments, you need to log in
You are not passing 3 different values for the -i argument, but one. To pass all three, you need to do this:
python3 app.py -i 155 2 3
['155', '2', '3']
<class 'list'>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question