亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

python執(zhí)行子進(jìn)程實(shí)現(xiàn)進(jìn)程間通信的方法

 更新時(shí)間:2015年06月02日 16:44:58   作者:niuniu  
這篇文章主要介紹了python執(zhí)行子進(jìn)程實(shí)現(xiàn)進(jìn)程間通信的方法,涉及Python使用subprocess模塊操作進(jìn)程的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了python執(zhí)行子進(jìn)程實(shí)現(xiàn)進(jìn)程間通信的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

a.py:

import subprocess, time
subproc = 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 sys
print('receive...')
s = sys.stdin.readline()
print('get:', len(s), s)

希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論