def regist():
f = open(r"G:课件day09 初始函数codeday009 初始函数account", mode="r", encoding="utf-8") # 注意mode="r"还是"r+",容易错!!!!!!!
while 1:
username = input("请输入用户名:")
password = input("请输入密码:")
for line in f:
if username == line.strip().split(":")[0]:
print("用户已经注册")
break
else:
print("恭喜,注册成功")
f.write(" " + username + ":" + password)
f.flush()
f.close()
return
regist() # -->没写这个,上面所有的白写!!!!!!!