#file_kana.py #open datafile_kana.txt file. Lines are this format: #potahe 58 14005 0.14 k koki lines = [line.rstrip().split() for line in open("datafile_kana.txt")] print("Number of lines:",len(lines)) ''' for line in lines: #any better way to get each column into a list??? # print(line) column1.append(line[0]) column2.append(int(line[1])) #split() made each a string column3.append(int(line[2])) column4.append(float(line[3])) column5.append(line[4]) ''' column2 = [int(line[1]) for line in lines] column3 = [int(line[2]) for line in lines] column4 = [float(line[3]) for line in lines] col2_sum = sum(column2) col3_sum = sum(column3) col4_sum = sum(column4) print("Sums: col2:",col2_sum," col3:",col3_sum," col4:",col4_sum) col2_min = min(column2) col3_min = min(column3) col4_min = min(column4) print("Mins: col2:",col2_min," col3:",col3_min," col4:",col4_min) col2_max = max(column2) col3_max = max(column3) col4_max = max(column4) print("Maxs: col2:",col2_max," col3:",col3_max," col4:",col4_max)