How can I get optparse's OptionParser to ignore invalid options?

后端 未结 5 1904
清歌不尽
清歌不尽 2020-12-09 15:53

In python\'s OptionParser, how can I instruct it to ignore

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 16:32

    Python 2.7 (which didn't exist when this question was asked) now provides the argparse module. You may be able to use ArgumentParser.parse_known_args() to accomplish the goal of this question.

提交回复
热议问题