I have a txt file which looks like this: (the first line is the information about the columns and I have 150+ lines)
E1, E2, E3, E4, E5, E6, E7, E8
abc, cba, dfa, gds, 60371, 42.1234, -2.12, hkfka
grs, fx, hgf, eff, 30331, 124, 31313.23, gj
.
.
.
Expected output:
abc, cba, dfa, gds, 60371, 42.1234, -2.12, hkfka
I read this file with with open method, then I want to find the largest number in the E5's column. It's '60371' in this example. After I found it, I'd like to write it's whole line to a text file. I can find the largest number by adding the string to a list, but can't write it's line with this method.
list = []
with open(file.csv, "r") as m:
text = m.readlines()[1:]
text = [line.replace(' ', '') for line in text]
for line in text:
currentline = line.split(",")
number= currentline[4]
list.append(number)
largest = max(list)
Edit: I'm not allowed to use any imports, such as panda, etc.