How to read/process command line arguments?

后端 未结 17 2050
离开以前
离开以前 2020-11-21 05:14

I am originally a C programmer. I have seen numerous tricks and \"hacks\" to read many different arguments.

What are some of the ways Python programmers can do this

17条回答
  •  粉色の甜心
    2020-11-21 05:33

    I recommend looking at docopt as a simple alternative to these others.

    docopt is a new project that works by parsing your --help usage message rather than requiring you to implement everything yourself. You just have to put your usage message in the POSIX format.

提交回复
热议问题