3 from optparse import OptionParser
5 parser = OptionParser()
6 parser.add_option("-i", "--infile", dest="infilename", help="read unparsed data from FILE", metavar="FILE", default="prefix.pre.dat")
7 parser.add_option("-o", "--outfile", dest="outfilename", help="write parsed data to FILE.alg.dat", metavar="FILE", default="prefix")
9 (options, args) = parser.parse_args()
11 in_file = open(options.infilename, "r")
22 lines = text.split("\n")
26 elements = line.split(" ")
28 (key, value) = elem.split("=", 1)
30 (_, prog) = value.split("/", 1)
35 algos[prog].append({'size': size, 'time': time})
40 out_file = open(options.outfilename+"."+key+".dat", "w")
41 for res in algos[key]:
42 out_file.write(res['size']+";"+res['time']+"\n")