Email Authentication
#Email validator import re f= open ('ValidEmails.txt', 'w') def is_email(): email=input("Enter your email") pattern = '[\.\w]{1,}[@]\w+[.]\w+' file = open('ValidEmails.txt','r') if re.match(pattern, email): file.write(email) file.close print("Valid Email") else: print("Invalid Email")
I am wondering why my data is not being written to disk. Python says my operation is not supported.
is_email file.write(email) io.UnsupportedOperation: not writable
Should I convert the email to a string like this, or
file.write(str(email))
is it something else
I probably missed something very simple.
Lenard
source share