学生系统注册功能
import Reg_def
pag_reg='''
=================
学生管理系统注册
1.输入用户名:
2.输入密码:
=================
'''
while True:
print(pag_reg)
name = ""
passwd = ""
def Reg_def(name, passwd, huan="\n"):
# print(name,passwd)
# print =(passwd)
# with open("./day11-文件操作/reg","r",encoding="utf-8") as f:
# reg1=f.read()
# str1 = str(name) + str(passwd) + str(huan)
with open("./day11-文件操作/reg", "a", encoding="utf-8") as f:
name = f.write(str(name))
passwd = f.write(str(passwd))
huan = f.write(str("\n"))
return (name, passwd, huan)
name, passwd, huan = Reg_def(str(input("姓名:")), str(input("密码:")))
#passwd=Reg_def(input("密码:") )
学生登录功能
page_login='''
===============
用户名:
密码:
================
'''
while True:
print(page_login)
name1=''
passwd1=''
name1=input("请输入用户名:")
passwd1=input("请输入密码:")
with open("./day11-文件操作/reg", "r", encoding="utf-8") as f:
content=f.readline()
while content:
content=f.readline()
# name2 = content.split(" ",2)
print(content)
if name1=="wyq" and passwd1=="333333":
print("登录成功,欢迎您!")
else:
print("登录失败!")
网友评论