Call Python script from bash with argument

前端 未结 8 808
长发绾君心
长发绾君心 2020-11-29 16:37

I know that I can run a python script from my bash script using the following:

python python_script.py

But what about if I wanted to pass a

8条回答
  •  有刺的猬
    2020-11-29 17:31

    Beside sys.argv, also take a look at the argparse module, which helps define options and arguments for scripts.

    The argparse module makes it easy to write user-friendly command-line interfaces.

提交回复
热议问题