Reading floats from file with python
问题 My input file has the form: 5.0, 1000.0, 100000000000000.0, 115.2712, 230.538, 345.796, 461.0408, 1.053E-09, 1.839E-09, 1.632E-10, 1.959E-12, 4.109, 3.683, 3.586, 3.650 where every number is essentially in a line. What I want to do is read all the floats, and then append only columns 7 through 10 to an array. Here's what I've written: T=[] with open("test.txt", "r") as file1: for line in file1.readlines(): f_list = [float(i) for i in line.split(",")] T.append(float(f_list[7])) T.append(float