(198)和(272)范围内[quant]字段中数字的平均值是多少
quant
95
189
176
200
177
340
205
203
284
88
109
83
360
67
250
56
111
439
354
143
这是我尝试过的代码。以上是我需要从中找到平均值的 [quant] 字段。
word_file = open('300000a.csv','r')
firstLine = True
for line in word_file:
if firstLine:
firstLine = False
continue
line = line.strip()
line = line.split (",")
field = int(line[0])
TotalMetalCount +=1
if field >198 or field <272:
metalCounts += 1
else:
metalCounts = 1
countT +=1
if field >198 or field <272:
count += 1