1 def out():
2 username=input("请输入用户名:\n")
3 password=input("请输入密码:\n")
4 return username,password
5 def registered():
6 username,password=out()
7 temp=username+"|"+password
8 with open(file="log.txt",mode="w",encoding="utf-8") as f:
9 f.write(temp)
10 def login():
11 username,password=out()
12 with open(file="log.txt",mode="r",encoding="utf-8") as f:
13 lists=f.read().split("|")
14 if username==lists[0] and password==lists[1]:
15 return True
16 else:
17 print("你登录的账户有误,请重新登录")
18 def profile():
19 with open(file="log.txt",mode="r",encoding="utf-8") as f:
20 lists=f.read().split("|")
21 print("欢迎访问{0}个人主页".format(lists[0]))
22 def main():
23 while True:
24 try:
25 f=int(input("1、注册 2、登录 \n"))
26 if f==1:
27 registered()
28 elif f==2:
29 if login()==True:
30 profile()
31 else:
32 print("请输入正确的账户密码")
33 else:
34 break
35 except:
36 continue
37
38 if __name__ == '__main__':
39 main()

最新文章

  1. 基础拾遗------webservice详解
  2. 手机APP创建桌面快捷方式
  3. js统计,然后去重例子
  4. 用帝国CMS时遇到的问题
  5. 条件随机场matlab程序下载
  6. salesforce 零基础学习(三十)工具篇:Debug Log小工具
  7. SQL一次查出多个字段的COUNT值
  8. fastReport 运行时设计报表 (mtm)
  9. Keepalived安装使用详解
  10. 搭建SpringMVC+MyBatis开发框架一
  11. MAC OSX 下安装 CTAGS
  12. html5 list属性、autocomplete属性、pattern属性
  13. Shader的使用
  14. chattr 命令详解
  15. webpack初探 - (一)
  16. Python_内置函数2_44
  17. 反向代理负载均衡之APACHE
  18. [转载]解决linux 下多线程错误 undefined reference to `sem_init'
  19. HTML与XHTML的差别(转自)http://jingyan.baidu.com/article/597035521c31ed8fc007400a.html
  20. 【Android】amr播放

热门文章

  1. swagger不再是第一选择了
  2. 小天才XTC Z1S开启ADB
  3. 《手写Mybatis》第4章:Mapper XML的解析和注册使用
  4. gin框架使用【1.Hello World】
  5. vue学习day02
  6. 2021.11.02 eleveni的水省选题的记录
  7. python基础练习题(题目 矩阵对角线之和)
  8. jmeter并发设置的原理
  9. PicLite 开发日志 v0.0.2
  10. XCTF练习题---MISC---坚持60S