python 进程间通信【转】
来源:互联网 发布:mac pdf阅读器 编辑:程序博客网 时间:2024/05/06 05:21
附:能够成功实现进程间通信的sample例程:
#程序A
#产生子进程B(receiver.py),并向其发送字符串
import subprocess, time
subproc = subprocess.Popen(['python', 'receiver.py'], stdin=subprocess.PIPE, shell=True) #运行子进程B
time.sleep(0.5)
print ‘start’
#下面两种方法都可以了
subproc.stdin.write(‘data\n’)
subproc.communicate(‘data\n’)
print ‘end’
#程序B receiver.py
#从stdin读字符串并打印之。
import sys
print ‘receive…’
s = sys.stdin.readline()
print ‘get:’, len(s), s
执行A得到返回结果:
start
receive…
get: data
end
- python 进程间通信【转】
- python 进程间通信
- python : 进程间通信
- python 进程间通信
- python 进程间通信
- python 进程间通信
- python进程间通信
- 【Python】进程间通信
- Python 进程间通信 Queue
- python进程间通信-Queue
- Python进程、进程池以及进程间通信
- python socket之进程间通信
- Python使用Socket 进行进程间通信
- 如何使用Python实现进程间通信
- Python socket 实现进程间通信
- Python进程间通信之匿名管道
- Python下的进程间通信-管道
- Python进程间通信之命名管道
- 基于visual c++之windows核心编程代码分析(33)实现防火墙模型
- 基于visual c++之windows核心编程代码分析(34)WinIo驱动级模拟按键的实现
- 浮栅三极管-FAMOS、SAMOS、MNOS和FLOTOX
- 企业级的开发组件05 - Infragistics NetAdvantage Ultimate 2011 Vol. 2
- 图搜索的通用算法
- python 进程间通信【转】
- 解析json格式的三种方法
- NYOJ 287 Radar
- do...while(0)的妙用
- Hudson --- 持续集成
- website collection
- cookie操作类(加密,获取,删除)
- linq to xml中group by的应用
- linq to xml