I want to save the text entered in the textboxes in a text file within the folder of my computer, and this is the code I am using for that but its keeps giving error.So please help and tell me how to rectify it.

来自tkinter进口*

def logadmin():

 if nameE in open("e:/pizzamanage/pizza.txt").read()or pwordE in open("e:/pizzamanage/pizza.txt").read():
    print("user already exists")
    regadmin()
else:
    open("e:/pizzamanage/pizza.txt").write(nameE) and open("e:/pizzamanage/pizza.txt").write(pwordE)

来自tkinter进口*

def regadmin():

rootbt.destroy()

global rootA

global nameE

global pwordE

rootA=Tk()

rootA.title("Admin SignUp")

nameL = Label(rootA, text='Username: ',width = 10,height=2,font=('ariel' ,16,'bold')) 

pwordL = Label(rootA, text='Password: ',width = 10,height=2,font=('ariel' ,16,'bold')) 

nameL.grid(row=0, column=0)

pwordL.grid(row=2,column=0)

nameE = Entry(rootA) 

pwordE = Entry(rootA, show='*')

nameE.grid(row=0,column=1)

pwordE.grid(row=2,column=1)

btnlog=Button(rootA,fg="black",font=('ariel',10),text="SignUp",bg="white",width=10,height=1,command=logadmin)

 btnlog.grid(row=4,column=0)

来自tkinter进口*

import time

global rootbt

rootbt=Tk()

rootbt.title("Pizza Management System:SignUp")

btnreg=Button(rootbt,fg="black",font=('ariel' ,16,'bold'), text="Admin SignUp", bg="powder blue",width = 20,height=2,command=regadmin)

btnreg.grid(padx=550,pady=200)

I am running it on Python 3.6.5, and this is the error it is giving:

Tkinter回调中的异常

Traceback(最近一次调用最后一次):

文件"C:\Users\jas\AppData\Local\Programs\Python\Python36-32\lib\tkinter__init__.py",第1702行,在 call 中返回self.func(* args)

logadmin中的文件“C:\ Users \ jas \ AppData \ Local \ Programs \ Python \ Python36-32 \ pizzanew.py”,第3行

如果nameE在open(“e:/pizzamanage/pizza.txt”) . read()或pwordE in open(“e:/pizzamanage/pizza.txt”) . read():

TypeError:'in'要求字符串作为左操作数,而不是Entry