Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
821 B
1
Indexable
Never
import re
from array import *

Matrix = []
f = open('/home/volkan/Desktop/leases', 'r')
lines = f.readlines()
newList = []
control = 0


for line in lines:
    words = line.split()
    for word in words:
        if re.match("^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$", word):
            #print(word)
            newList.append(word)
        elif word == "free;" or word=="active;":
            control += 1
            if control==1:
                newList.append(word)
        elif word=="set vendor-class-identifier" or word=="client-hostname":
            newstring = words[-1]
            newList.append(newstring)
        elif re.match("([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}", word):
            #print(word)
            newList.append(word)
            print(newList)
            newList.clear()
            control=0