python调用pipe

cmd = "e:\\dmin\\AdminD.exe online"
        ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE)
        ps.stdin.write("file=烂烂烂服务器.role\n") #注意加"\n"
        ps.stdin.write("exit\n")
        data = ps.stdout.read()
        #data = ps.communicate("file=烂烂烂服务器.role"
原文地址:https://www.cnblogs.com/linn/p/1333502.html