I made a login system but when I run it, it comes up with an unexpected result can you ether fix it or improve it? : <p>i have repentantly started object oriented on python so I made a login system but when I run it, it comes up with an unexpected result at the end</p>

<p>it was supposed to print "login successful" but doesn't and comes up with "login failed" even though it print the value both in module and the file and they look identical but it outputs that they are not?
does anyone know why this happens</p>

<pre><code>firstname="food"#given veriables 
lastname="boyyyyyy"#given veriables 
username=firstname+lastname#given veriables 
password="errrorrr"#given veriables 
thislist = ["rusty_sword", "cloth_shirt", "wooden_shield","health_potion"]#given veriables 
demon_kill=0#given veriables 
potion_number=5#given veriables
gold=10#given veriables
area=0#given veriables


thisdict = {"username": firstname+lastname,"password": password,}#creates dictionary
print(thisdict)#shows dictionary
class saving:#creates class called saving
  def __init__(self,info,equipment_w,equipment_a,equipment_s,equipment_p,demon_kill_obj,potion_number_obj,gold_obj,area_obj):#creates objetcs
    self.thisdict=thisdict#sets objects values
    self.equipment_w=equipment_w#sets objects values
    self.equipment_a=equipment_a#sets objects values
    self.equipment_s=equipment_s#sets objects values
    self.equipment_p=equipment_p#sets objects values
    self.demon_kill_obj=str(demon_kill_obj)#sets objects values
    self.potion_number_obj=str(potion_number_obj)#sets objects values
    self.gold_obj=str(gold_obj)#sets objects values
    self.area_obj=str(area_obj)#sets objects values
  def fileing(self):#creates objetcs
    f=open(self.thisdict["username"]+" personalgame save.txt","a")#opens files from dictionary
    f.truncate(0)#sets file as empty
    f.write(self.thisdict["username"]+"\n")#writes in file using objects
    f.write(self.thisdict["password"]+"\n")#writes in file using objects
    f.write(self.equipment_w+"\n")#writes in file using objects
    f.write(self.equipment_a+"\n")#writes in file using objects
    f.write(self.equipment_s+"\n")#writes in file using objects
    f.write(self.equipment_p+"\n")#writes in file using objects
    f.write(self.demon_kill_obj+"\n")#writes in file using objects
    f.write(self.potion_number_obj+"\n")#writes in file using objects
    f.write(self.gold_obj+"\n")#writes in file using objects
    f.write(self.area_obj)#writes in file using objects
    f.close#closes file
kkkk=saving(thisdict,thislist[0],thislist[1],thislist[2],thislist[3],demon_kill,potion_number,gold,area)#takes info from class and saves it to kkkk
kkkk.fileing()

f=open(thisdict["username"]+" personalgame save.txt","r")#opens the file
lines=f.readlines()#sets points in the file to seperate veriables
print(username)#shows you  what username is in veriables
print(lines[0])#show you what username is in the file
if str(username)==str(lines[0]):#compares the the two veriables
  print("login sucessfull")
else:
  print("login falied")
</code></pre>
