Python 脚本之间的通信 [英] Communication between Python Scripts

查看:70
本文介绍了Python 脚本之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 2 个 python 脚本.第一个是 Flask 服务器,第二个是 NRF24L01 接收器/发射器(在 Raspberry Pi3 上)脚本.两个脚本同时运行.我想在这两个脚本之间传递变量(变量不是常量).我怎样才能以最简单的方式做到这一点?

I have 2 python scripts. 1st is Flask server and 2nd Is NRF24L01 receiver/transmitter(On Raspberry Pi3) script. Both scripts are running at the same time. I want to pass variables (variables are not constant) between these 2 scripts. How I can do that in a simplest way?

推荐答案

python RPC 设置怎么样?IE.在每个脚本上运行一个服务器,每个脚本也可以是一个客户端,相互调用远程过程调用.

How about a python RPC setup? I.e. Run a server on each script, and each script can also be a client to invoke Remote Procedure Calls on each other.

https://docs.python.org/2/library/simplexmlrpcserver.html#simplexmlrpcserver-example

这篇关于Python 脚本之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆