我有两个脚本文件'来电.py'和'阅读.sh'
这是我的来电.py'
# -*- coding: utf-8 -*
from subprocess import PIPE, Popen
p = Popen('echo abc', stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=1, shell=True)
print 'pid is: ' + str(p.pid)
print p.stdout.read()
p = Popen('bash read.sh', stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=1, shell=True)
print 'pid is: ' + str(p.pid)
p.stdin.write('testinput\n')
print p.stdout.read()
这就是阅读.sh你知道吗
#!/bin/bash
read -p "please input:" a
echo 'a is: ' $a
我用python2.7运行
python caller.py
输出为:
pid is: 13535
abc
pid is: 13536
a is: testinput
我的问题是'read -p'
“的提示在哪里,应该有”请在输出中输入:“?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐