Guest User

Untitled

a guest
Jun 2nd, 2017
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. strStr = ["192.168.42.12", "192.168.42.2"]
  2. # the "e:\temp\111.txt" is the searching file storage path.
  3. with open(datausage) as f:
  4.     lines = f.readlines()
  5.     for line in lines:
  6.         for ii in strStr:
  7.             if ii in line:
  8.                 result = line
  9.                 ip = line[5:-50]
  10.                 result_ip = ip.replace(" ", "")
  11.                 usage = line[-8:]
  12.                 d = usage.replace('KB', '')
  13.                 usage = d.replace('B', '')
  14.                 usage = usage.replace('\n', '')
  15.  
  16.                 print result_ip + '\t\t\t' + str(usage)
Add Comment
Please, Sign In to add comment