On Thu, 23 May 2013 01:13:19 +0900, Keira Wilson wrote: > I would appreciate if someone could write a simple python code for the > purpose below:
Didn't have your data, so couldn't verify it completely, but try this: import re def v(s): l=len(s) t=0. for i in range(l): t=t+(abs(ord(s[i]))*1.) return t/(l*1.) for n in range(5): m="c:/test/"+str(n+1)+".txt" f=open(m,"r") d=[] t=0. for l in range(10): d=d+[re.findall(r"[0-9.eE+-]+",f.readline())] t=t+v(d[l][0]) f.close() c=t/10. if c==50.: t=0. for u in range(10): t=t+v(d[0][u]) r=t/10. print "%s C1: %f R1: %f"%(m,c,r) -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list