假设我有一堆这样的短信:
"title": "Blog post headline",
"url": "http://urlofblogpost.com/article",
"title": "Blog post2 headline",
"url": "http://urlofblogpost.com/article2",
或者像这样(如果我把它清理一下):
Blog post headline
http://urlofblogpost.com/article
B
下面是我的子进程调用:
def myrun(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout = []
while True:
line = p.stdout.readline()
stdout.append(line)
print line,
if line == '' and p.poll() != None:
break
return ''.j