#!/usr/bin/python3 import os
INFILEEXT = ".xvg" NUM_OF_FILES = 2 if __name__=="__main__": result = [ [] for i in range(NUM_OF_FILES)] for i in range(NUM_OF_FILES): filename = "A_mindist_" + str(i+1) + INFILEEXT #text = open(filename,"r").readlines() with open(filename,"r") as f: for line in f: if len(line.strip()) == 26: result[i].append(line.strip().split()[1]) for i in range(len(result)): for j in range(len(result[i])): print(result[i][j]) still have a little problem about print out, I wish to get like a a b b c c which will show in the same line, not as a b c a b c Thanks, cat A_dist_1.xvg @ legend loctype view @ legend 0.78, 0.8 @ legend length 2 @ s0 legend "r_24-r_29" 0.000000e+00 2.109407e-01 4.000000e+03 2.263405e-01 8.000000e+03 3.234825e-01 _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor