我是Python新手,我希望运行多个并行ssh连接和到设备的命令。我用pssh
link来做它。
问题是设备在连接后会返回一些大标题,比如20-30行。
当我使用下面的代码时,打印出来的是命令的结果,但是在顶部还有一个大的标题,它是在登录之后打印出来的。在
hosts = ['XX.XXX.XX.XXX']
client = ParallelSSHClient(hosts, user='XXXX', password='XXXXX')
output = client.run_command('command')
for host in output:
for line in output[host]['stdout']:
print line
总之我能得到命令输出吗?在
我不太明白你的意思。 我也在使用pssh,似乎我在使用与您相同的方法来打印命令的输出,请参见以下内容:
你能再详细一点吗?也许可以提供一个你运行的命令和你得到的输出的例子?在
检查pssh。
此工具使用多线程,执行速度快。
你可以阅读更多关于它的here。在
相关问题 更多 >
编程相关推荐