通过pexpect获取集群主机信息
import pexpect
ip = ‘xx‘
cmd = ‘xx‘
ssh = pexpect.spawn(‘ssh %s %s‘ %(ip,cmd))
r = ssh.read()
print r
时间: 2024-10-19 15:36:22
通过pexpect获取集群主机信息
import pexpect
ip = ‘xx‘
cmd = ‘xx‘
ssh = pexpect.spawn(‘ssh %s %s‘ %(ip,cmd))
r = ssh.read()
print r