TLen = 0; n = 0
fh = open('B1.csv')
fh.readline()
for line in fh:
    data = line.split(",")
    TLen += int(data[1])
    n += 1
print(TLen/float(n))
fh.close()

This code is part of the book "Python for Bioinformatics", by Sebastian Bassi (sbassi@genesdigitales.com). Return to home page.