Below I have a list identifiers where values are appended within for loop logic not shown, this part is fine as it's quite basic.
The next part is where I am quite confused as to what I am doing wrong, so I open a local text file and readLines here, I use a for loop to iterate through those lines. If any of the lines in the textfile match any of the lines in the identifiers list then I do not want to send an email (email function is fine). If the ID isn't in the textFile I want to write this id from identifiers list to the text file, the way it is working at the minute it does not seem to do anything.
identifiers = []
....
identifiers.append(rowList[0])
....
fo = open('localDirectory/textFile.txt', 'r+')
content = fo.read().splitlines()
for id in content:
if any(i in id for i in identifiers):
print("No email to send")
else:
fo.write(identifiers[i]+'\n') **Write new ID to indentifiers text file**
#Send Email