I am trying to create a script that takes multiple command line arguments of the same type, and then feeds them into a for loop for processing, the below is what I have in my code:
import argparse
parser = argparse.ArgumentParser(description='XYZ')
parser.add_argument('[values]', nargs='+', help='A list of values')
u = parser.parse_args(['3crlV5QaiuUjRz5kWze', 'F9Xw0rggHZ_PLs62q'])
for values in u:
... # do a bunch of stuff for each "value"
I understand that the values stored in parse_args are a NAMESPACE, hence the error below when I run my code:
TypeError: 'Namespace' object is not iterable
Is there any way to turn them into a list object? so that I can pass them to my for loop, or is there any other approach I should be using? Just getting started with python, so apologies in advance if this is a noob question