Well the program is supposed to check if the it sees an "ok" next to the email and if it does spit out the email in another txt file.
Input txt file:
.......ng0@gmail.com,ok
.......ad@live.com,fail
.......12@live.com,fail
.......5w@live.com,fail
.......np@gmail.com,ok
.......an@live.com,fail
.......40@excite.com,fail
.......g1@gmail.com,ok
python code is:
readEmails = open("C:\\Users\\Greg\\Desktop\\rewriteEmails.txt","r")
writeEmails = open("C:\\Users\\Greg\\Desktop\\OutputEmails.txt","w")
for line in readEmails:
subbed = line[-3:]
if subbed == "ok":
split = line.split(",")
writeEmails.write(split[0])
print("Email Added")
else:
print("Error")
The program seems to always go to the else part of the if statement. I'm kinda having a brain fart; i would love your advice.