且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用argparse传递参数后,如何将python脚本作为批处理作业运行?

更新时间:2023-10-21 17:08:58

您需要将参数传递给python脚本.如果您知道参数的确切数目,则可以这样写:

You need to pass along the arguments to the python script. If you know the exact number of your arguments you can write smth like:

#!/bin/bash
# passing two arguments
python message_script.py "$1" "$2"

或全部:

#!/bin/bash
python message_script.py "$@"