i__Will 发表于 2014-10-08 15:58

shell 调用python并传参

python脚本通过optparse处理命令行参数:

parser.add_option("-v", "--verbose",
                  action="store_true", dest="verbose", default=True,
                  help="make lots of noise ")
......

在执行python脚本时,可以输入参数example.py --file=1 --port=2

当使用shell脚本调用该python脚本时,如何指定这些参数呢?如file, port?
python example.py --file=1 --port=2 这样明显是不可以的。
页: [1]
查看完整版本: shell 调用python并传参