The files are the exact same, I'm applying regex to string input on copies of 2 exact same file, but i am not sure how to do the comparison of the groups. Here is my code:
for res1 in result1:
for res2 in result2:
res2 = res2.group()
if res1.group() != res2:
print(res1.group())
trying to compare it like this only the last group matches, so I believe it has something to do with indentation. result1 is the regex result on the first file, result 2 is the regex result on second file. they're callable objects, so I'm looping through them and tryin to compare. There should be no difference. Would anyone have any tips? I am thinking about using isdiff instead, although I have never used it. Below is a bit more of the code.
else:
read1 = open(fle + '.txt')
result1 = re.finditer(regex, read1.read())
with open(infile, "r") as x:
result2 = re.finditer(regex, x.read())
for res1 in result1:
for res2 in result2:
res2 = res2.group()
if res1.group() != res2:
everything else in the script seems to be working as intended, at this point I am stuck comparing regex groupings, which in the current situation should be the same. I've recopied the file a few times and tested.