File size: 396 Bytes
84a4607 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#!/usr/bin/env python3
import sys
file = sys.argv[1]
key = sys.argv[2]
with open(file, "r") as f:
lines = f.readlines()
wers = []
count = 0
for line in lines:
if key in line:
wers.append(float(line.split(key)[-1].lstrip().rstrip()))
count += 1
mean = sum(wers) / len(wers)
var = sum([(w - mean)**2 for w in wers]) / len(wers)
print("mean", mean)
print("var", var)
|