Untitled
unknown
python
3 years ago
666 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 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