File size: 443 Bytes
34292e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import re
pattern = "(hold\d+)"
cset = set()
count = 0
with open("reports/gf12/bp_single/min_delay_report_osta.rpt", "r") as f:
while True:
line = f.readline()
if not line:
break
m = re.search(pattern, line)
if m:
name = m.group(0)
if name not in cset:
cset.add(name)
count += 1
else:
continue
print(count)
|