diff options
author | Florian Jung <flo@windfisch.org> | 2016-01-07 00:44:01 +0100 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2016-01-07 00:44:01 +0100 |
commit | a7763a22a08117dca62a6e9616ecea33fe7e4c65 (patch) | |
tree | 92d0340418bdc9326479f0f01ca58d1226fdd5f6 /avg.py | |
parent | f9a9a51884aadef97b8952b2807541d31b7e9917 (diff) |
doc
Diffstat (limited to 'avg.py')
-rw-r--r-- | avg.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -0,0 +1,14 @@ +from sys import argv + +#usage: avg.py outfile infile1 infile2 ... + +outfile, infiles = open(argv[1],"w"), [open(arg,"r") for arg in argv[2:]] + +# hell yea! i f***ing love python :'D +for lines in zip(*infiles): + for columns in zip(*[l.split() for l in lines]): + print("%e" % ( sum([float(c) for c in columns])/len(columns) ) ,file=outfile, end="\t") + print("", file=outfile) + +for f in [outfile]+infiles: + f.close() |