Hi, 1] How to input some column in idle
like: a a a 2] I want to combine a series of files like a.txt 1 a 2 a 3 a b.txt 1 b 2 b 3 b into one as: a b a b a b The work-in-progress code as following, #!/usr/bin/python3 import os INFILEEXT = ".xvg" NUM_OF_FILE = 10 if __name__=="__main__": result = [0]*NUM_OF_FILE for i in range(NUM_OF_FILE): filename = "A_mindist_" + str(i+1) + INFILEEXT #text = open(filename,"r").readlines() with open(filename,"r") as f: for line in f: parts = f.readline().strip() if len(parts) == 26: dist = parts.split()[1] print(dist) result[i].append(dist) print(result) $ cat A_mindist_1.xvg 4.640000e+05 3.169008e-01 4.680000e+05 4.319328e-01 4.720000e+05 5.126960e-01 $ cat A_mindist_2.xvg 4.640000e+05 5.237660e-01 4.680000e+05 2.352828e-01 4.720000e+05 2.280239e-01 I wish result[0] = 3.169008e-01 4.319328e-01 5.126960e-01 result[1] = 5.237660e-01 2.352828e-01 2.280239e-01 Thanks with best regards, _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor