Minimum verifiable example:
import argparse parser = argparse.ArgumentParser(description='...') parser.add_argument('-f','--file', type=str, nargs='+', help='file list') args = parser.parse_args() print(args.sparse[:]) And the idea is that I call this as:
python my_script.py -f f1 f2 f3 -f some_other_file1 some_other_file2 ... And the output would be:
[ [ f1 f2 f3 ] [ some_other_file1 some_other_file2 ] ] However, in this case, all that is printed out is:
[ some_other_file1 some_other_file2 ]