import sys import csv #path = '/mathdata/dayhoff-work/orzechma/SeniorThesis/safePrimeStatusFiles/' def main(argv): n = argv[0] path = argv[1] loc = argv[2] s = 'status_' + n + '.txt' f = open(path + s, 'r') data = [0]*9 data[0] = n #for line in f: while 1: line = f.readline() if not line: break #print "Original line is: %s" % line line = line[:-1] #print "New line is: %s" % line temp = f.readline() if not temp: break #print "Original temp is: %s" % temp temp = temp[:-1] #print "New temp is: %s" % temp if line == 'Average Tail Length': data[1] = temp continue if line == 'Average Cycle Length': data[2] = temp continue if line == 'Average Rho Length': data[3] = temp continue if line == 'Variance of Average Tail Length': data[4] = temp continue if line == 'Variance of Average Cycle Length': data[5] = temp continue if line == 'Variance of Average Rho Length': data[6] = temp continue if line == 'Tau of Average Rho Length': data[7] = temp continue if line == 'Covariance between Average Tail Length and Average Cycle Length': data[8] = temp continue f.close() #for i in range(0,9): # print data[i] #csvfile = open('discLogSafePrimeData.csv', 'at') csvfile = open(loc, 'at') #c.write(data) writer = csv.writer(csvfile, delimiter=',', lineterminator='\n') writer.writerow(data) csvfile.close() if __name__ == "__main__": main(sys.argv[1:])