Python C程序子进程挂在“ITER中的行”
#include <stdio.h>int main() {while (1) { printf("2000\n"); sleep(1);}return 0;}
"2000"
#!usr/bin/pythonimport subprocess process = subprocess.Popen("./main", stdout=subprocess.PIPE)while True: for line in iter(process.stdout.readline, ''): print line,
.Popen
for line in iter(process.stdout.readline, ''):
编辑:
绝地无双
相关分类