Arbitrary command line arguments in python

前端 未结 3 1646
离开以前
离开以前 2021-01-06 11:55

I want to allow arbitrary command line arguments. If the user provides me with a command line that looks like this

myscript.py --a valueofa --b valueofb posar

3条回答
  •  北海茫月
    2021-01-06 12:31

    Will argparse do what you want? It was recently added to the standard library. Specifically, you might want to look at this section of the documentation.

提交回复
热议问题