修改下面代码 with openCommands r as f commands = freadlines printcommands for command in commands printcommandstrip stdin stdout stderr = selfsshexec_comma
with open('Commands.txt', 'r') as f: commands = f.readlines() print(commands) for command in commands: print(command.strip())
stdin, stdout, stderr = self.ssh.exec_command(command.strip())
output = stdout.read().decode('utf-8')
print(output)
print(stderr.read().decode()) # 修改了最后一行,应该打印stderr而不是stdout。
原文地址: http://www.cveoy.top/t/topic/hcJd 著作权归作者所有。请勿转载和采集!