您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

python执行子进程实现进程间通信的方法

2024/4/26 15:08:58发布22次查看
本文实例讲述了python执行子进程实现进程间通信的方法。分享给大家供大家参考。具体实现方法如下:
a.py:
import subprocess, timesubproc = subprocess.popen(['c:\python31\python.exe', 'c:/b.py'], stdin=subprocess.pipe, shell=true) time.sleep(0.5)print('start')subproc.stdin.write('data\n')subproc.communicate('data\n')print('end')
b.py:
import sysprint('receive...')s = sys.stdin.readline()print('get:', len(s), s)
希望本文所述对大家的python程序设计有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product