Problems with text file appending in python -


i having python problems.

i have made program ask user email address , appends text file, after doing checks, working fine, ends nothing in text file, though no errors show up.

my code is:

def main():     print("hello , welcome customer email program!")      count=0      while count < 1:         email=str(input("email address: "))         if "@" in email:             if email.islower == true:                 count=2                 open("emails.txt", "a") myfile:                     myfile.write(email)                 print("file added databse")             else:                 email=email.lower()                 count=2                 open("emails.txt", "a") myfile:                     myfile.write(email)         else:             print("that not email address, please try again.") main() 

any appreciated.

i think should open file , close file after append it:

def main() :     print("hello , welcome customer email program!")      done = false      while not done :         email = str(input("what's email address? "))         if "@" in email :             if not email.lower() == email :                 email = email.lower()             done = true             f = open("emails.txt" "a")             f.write(email)             f.close()         else :             print("please type in valid email address, "+email+" isn't valid email address") main() 

does fit needs?


Comments