tempfile = "temp.txt"
runc = get_config_ssh(ipSw,cisco_user,cisco_pass,"show switch")
outfile = open(tempfile, "w")
outfile.write(runc)
outfile.close
nstack = 0
with open(tempfile) as infp:
data = infp.read()
print dataTshoot: 1-执行后的temp.txt文件包含数据,但如果我尝试使用python读取,则不显示任何结果。
2-如果我更改了命令,例如我向开关发出的"show int status“,它就可以工作,它会打印由python scrypt读取的数据
3- show switch和show int status这两个命令输出都是明文形式,并且在执行后都会出现在temp.txt文件中。
write方法有问题吗?
SSH连接在temp.txt文件中写入数据,但当我稍后读取它时(打开...)打印数据不显示任何结果。
有人能帮我解决这个问题吗?谢谢
https://stackoverflow.com/questions/51376555
复制相似问题