I have a .txt file with data in the following format:
pq1000007 35 2 237493054 0.013328573
I am trying to use regex that will capture the first, third, and last number, but only if the last number is greater than .4. For some reason, I get the message that "NoneType object has no attribute 'group'". Any ideas?
Code:
InFileName = "PerkQP_CHGV_SCZ.txt"
InFile = open(InFileName, 'r')
OutFileName='PAZ_OUT' + ".txt"
OutFile=open(OutFileName, 'w')
for Line in InFile:
match = re.search('(\w+)\s\d+\s(\d+)\s\d+\d+\s(\d+\.\d+)', Line)
if match.group(2) > 0.4:
c = match.group()
print(c)
OutFile.write(c+"\n")
InFile.close()
OutFile.close()