Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strStr = ["192.168.42.12", "192.168.42.2"]
- # the "e:\temp\111.txt" is the searching file storage path.
- with open(datausage) as f:
- lines = f.readlines()
- for line in lines:
- for ii in strStr:
- if ii in line:
- result = line
- ip = line[5:-50]
- result_ip = ip.replace(" ", "")
- usage = line[-8:]
- d = usage.replace('KB', '')
- usage = d.replace('B', '')
- usage = usage.replace('\n', '')
- print result_ip + '\t\t\t' + str(usage)
Add Comment
Please, Sign In to add comment