#!/usr/bin/env python#-*- encoding:utf-8 -*-import paramikotransport = paramiko.Transport(('10.34.1.18', 22))transport.connect(username='ahwater', password='Aa7788..')ssh = paramiko.SSHClient()ssh._transport = transportcmd04='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=0for i in da005: lens=len(da005) #print(lens) #if lens % 2 == 0: couns = couns + int(i) #lens=lens - 1print couns #print("mem total Gb: ",data04)
posted on 2017-07-13 15:42 阅读( ...) 评论( ...)