Open Anthony-Dong opened 11 months ago
import argparse if __name__ == '__main__': parser = argparse.ArgumentParser(description='Test Cli') parser.add_argument('--file', '-f', dest='files', nargs='+', type=str, required=False) args = parser.parse_args() print(args)
In python, nagrs is convenient for dealing with array types, but with pflag we need to define flag repeatedly
➜ python git:(master) ✗ python main.py -f main.py init.py Namespace(files=['main.py', 'init.py'])
In python, nagrs is convenient for dealing with array types, but with pflag we need to define flag repeatedly