3 ms·
I like optparse, but I wish it handled positional arguments too. (I fully expect someone to now come and tell me how to get it to handle positional arguments e
by DannoHung 17y ago
I like optparse, but I wish it handled positional arguments too.
(I fully expect someone to now come and tell me how to get it to handle positional arguments easily)
- makecheck 17y agoI think what you're looking for is the parse_args() method, which returns a pair; one part is the named option values, the other part is everything that's left. So you handle positional arguments by iterating over the "what's left" part.
- DannoHung 17y agoNope. I still need to # Check which arguments are available # Cast them # Provide utilization information for the arguments # Provide defaults # Do all the other stuff that optparse does for options Hmm... I guess Google's argparse really is the future.