Comma separated inputs instead of space separated inputs for argparse

前端 未结 5 1013
灰色年华
灰色年华 2021-01-19 02:30

I\'m using argparse to receive inputs from the command line to run my script.

My current input string looks like this:

path> python &         


        
5条回答
  •  灰色年华
    2021-01-19 03:10

    There is no such feature in argparse.

    Alternatives:

    • post-process the args namespace and split/parse the values manually
    • define a custom action and split/parse the values manually
    • define a custom type and split/parse the values manually
    • subclass ArgumentParser and customise ArgumentParser.convert_arg_line_to_args

提交回复
热议问题