argparse and subparsers

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Sun Jun 26 23:15:41 EDT 2016


On Monday, June 27, 2016 at 6:56:41 AM UTC+12, Joseph L. Casale wrote:
> This has become unmaintainable as the manual slicing is always subject
> to a new case by where a parser has a positional, switch or optional
> parameter for example. Also, since argv is grouped by subparser
> specifiers, if a parameter has input that matches a keyword
> it all goes pear shaped.

Write your own parser. It’s not hard--the common Unix/Linux command line conventions are quite simple, and it’s already pre-split into words for you.



More information about the Python-list mailing list