shell脚本中怎么调用python脚本中的带参函数

如题所述

# python脚本 test.py

# coding: utf-8
import sys

def print_data(a, b, c):
print a, b, c

if __name__ == "__main__":
print_data(sys.argv[1], sys.argv[2], sys.argv[3])

# shell 脚本
python test.py a b c
# 结束
a b c
温馨提示:答案为网友推荐,仅供参考
相似回答