This script is meant to read through a file and take in the number (numA) and the text next to it (sourceA). It then uses this and compares it to every other line in the file. If a match in "nums" is found but not in sources, it writes the num to a file along with the sources it appears in.
with open(sortedNums, "r")as sor:
for line in sor:
NumsA, sourceA = line.split('####')
for line in sor:
if '####' in line:
NumsB, sourceB = line.split('####')
if (NumsA == NumsB) & (sourceA != sourceB):
print("Found reused Nums")
with open(reusedNums, 'a')as reused:
reused.write(NumsA + ' ' + sourceA + ' ' + sourceB)
print ("setA: " + NumsA + ' ' + sourceA)
print ("setB: " + NumsB + ' ' + sourceB)
Most of this is working except that it does the full inner loop but only the first iteration of the outer loop