I am trying to code a program that prints out the specific rows/lines where one value exceeds the other one in that line. For example ,this is a small part of the text file:
01,test1,202,290,A,290
02,test2,303,730,A,0
03,test3,404,180,N,180
The program that I am trying to code would select all lines that have 'A' in them but also select the lines where the 4th column (290 for the first line) is greater then the 6th column (290 in the first line)and then print them.So the program should only print this line in the text file above in python:
02,test2,303,730,A,0
The best I can do is simply print all lines that have 'A' in them by using:
F = open("TEST.txt").read()
for line in F.split():
if 'A' in line:
Column=line.split(',')
However this only selects the lines with 'A' in them ,when I attempt to filter it based on whether the 4th column is greater then the 6th column,I get various errors.Can somebody please help me with this problem?