Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whether nargs is supported #391

Open
Anthony-Dong opened this issue Dec 4, 2023 · 0 comments
Open

Whether nargs is supported #391

Anthony-Dong opened this issue Dec 4, 2023 · 0 comments

Comments

@Anthony-Dong
Copy link

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'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant