i want to edit email id and phone number by taking user input but i am unable to that through this what i am doing wrong in this code help.
file.txt
Jon Snow 996452544 Jon@gmail
Robb 885546694 Robb@gmail
Robert 896756885 Robert@gmail
code
def editContact():
obj2 = open("address.txt","r")
output = []
old_email=raw_input("Enter old email address : ")
new_email=raw_input("Enter new email address : ")
s = re.sub(old_email, new_email, obj2)
obj1 = open("address.txt","w")
obj1.writelines(s)
re.subshould be a string not a file object.