大佬教程收集整理的这篇文章主要介绍了将值发送到 python 脚本然后运行,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
抱歉,各位,我是 php 开发人员,而不是 Python 开发人员。这对某人来说可能是非常基本的。我想导入一个 python 脚本,但向它发送一个值 (ID) 以便它运行。我有一个“父”页面,在其他脚本之后导入一个页面,并在它们返回预期值时运行它们。使用 python 3
On parent script...
import script1 << give ID
script 1 get the ID and run a query and return values
impot script2 << send ID
script 2 get the ID and run a query and return v
通常的pythonic方式是导入所需的方法并在脚本中执行这些方法。请参考下面的例子。
script1
def example_method():
return 1
script2
def example_method_2():
return 1
你的脚本
from script1 import example_method
from script2 import example_method_2
result1 = example_method()
result2 = example_method_2()
以上是大佬教程为你收集整理的将值发送到 python 脚本然后运行全部内容,希望文章能够帮你解决将值发送到 python 脚本然后运行所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。