I have a text file with multiple lines and want to find which lines have values greater than 85%.
'workdata worka worka1 size 84% total'
'workdata workb workb1 size 89% total'
'workdata workc workc1 size 63% total'
'workdata workd workd1 size 94% total'
If you know the percentage will always be in the 5th column, then just split each row on space, remove the percentage sign, and turn it into a float. Something like this:
lines = open("fileName", "r").read().splitlines() for row in lines: if float(row.split().replace("%",""))>85: print(row)