#!/usr/bin/env python
#-*- encoding:utf-8 -*-
import paramiko
transport = paramiko.Transport(('10.34.1.18', 22))
transport.connect(username='ahwater', password='Aa7788..')
ssh = paramiko.SSHClient()
ssh._transport = transport
cmd04='wmic memorychip get capacity'
stdin,stdout,stderr = ssh.exec_command(cmd04)
da04=stdout.read().strip('Capacity').replace(' ','').replace('\t','').replace('\r','').strip()
da004=(' '.join(filter(lambda x: x, da04.split(' '))))
da005=da04.split('\n')
print da005
#data04=int(da04)/1024/1024/1024
#print da005[1],da005[2]
couns=0
for i in da005:
lens=len(da005)
#print(lens)
#if lens % 2 == 0:
couns = couns + int(i)
#lens=lens - 1
print couns
#print("mem total Gb: ",data04)
python paramiko 调试
原创mb61b9f9821005c ©著作权
©著作权归作者所有:来自51CTO博客作者mb61b9f9821005c的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
python install paramiko
paramiko模块正确的安装步骤
安装 install paramiko -
paramiko
paramiko
paramiko 51cto