0
使用Python和的paramiko,我有以下的代碼使用paramiko,我怎麼能實時獲得exec_command()的stdout而不是完成後?
(stdin, stdout, stderr) = self.client.exec_command(x)
b = stderr.readlines()
if b:
for i in b:
print i
a = stdout.readlines()
if a:
for i in a:
print i
我運行的命令需要15分鐘,輸出穩定更新到stdout,但直到它完成它不會在主機端打印。
有沒有辦法得到活的標準輸出而不是等待?謝謝。
可能重複[獲取輸出從paramiko ssh exec \ _command不斷](http://stackoverflow.com/questions/31834743/get-output-from-a-paramiko-ssh-exec-command-continuously) –