2024-04-25 13:19:15 发布
网友
如果我的shell脚本中有某个函数,我可以从外部python脚本调用该函数吗?在
以下是一些参考资料,因为我不太清楚你想做什么:
Running Shell Commands
您可以使用Pythonsubprocess模块:
from subprocess import call call(["ls", "-l"])
或者,如果您试图从shell脚本内部运行一个特定的函数,那么在Python中重新编写该函数的代码会更加明智。类似的SO问题可以在这里找到:
How to call a shell script function/variable from python?
以下是一些参考资料,因为我不太清楚你想做什么:
您可以使用Pythonsubprocess模块:
或者,如果您试图从shell脚本内部运行一个特定的函数,那么在Python中重新编写该函数的代码会更加明智。类似的SO问题可以在这里找到:
How to call a shell script function/variable from python?
相关问题 更多 >
编程相关推荐