python实现登录密码重置简易操作代码
作者:秦朗的天空 时间:2022-12-08 13:34:43
需求:
1.用户输入密码正确登录
2.用户输入密码错误退出并调用函数继续输入
3.用户输入密码符合原先给定的一个值时,允许用户重置密码,并且可以用新密码登录
4.输入三次后禁止输入
虽然贴别的简单,但是还要记录一下,废话不多说直接贴码了
#!/user/bin/env python
#-*-coding:utf-8 -*-
#Author: qinjiaxi
password_list = ['!@#', '12345']
def account_login():
tries = 3
while tries > 0:
password_input= input('请输入密码:')
password_correct = password_input == password_list[-1]#由于判断条件过长可以复制给一个变量,这样看起来代码整洁干净一些
password_reset = password_input == password_list[0]
if password_correct:
print('login success!')
elif password_reset:
new_password = input('请输入新的密码:')
password_list.append(new_password)
print('你的密码已经修改成功')
account_login()
else:
print('输入错误')
tries -= 1
else:
print('输入次数超限')
account_login()
总结
以上所述是小编给大家介绍的python实现登录密码重置简易操作,网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
来源:https://www.cnblogs.com/qinlangsky/p/9449533.html
标签:python,登录,密码,重置
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python仿evething的文件搜索器实例代码
2022-05-05 09:05:15
![](https://img.aspxhome.com/file/2023/3/99423_0s.png)
selenium+python自动化测试之环境搭建
2022-05-15 13:51:32
![](https://img.aspxhome.com/file/2023/1/75901_0s.png)
如何将bag文件批量转成mp4
2021-06-10 11:04:54
Jaspersoft Studio添加mysql数据库配置步骤
2024-01-17 01:13:26
![](https://img.aspxhome.com/file/2023/3/104413_0s.png)
Oracle与SQL Server数据库镜像对比
2009-03-25 14:27:00
python实战教程之OCR文字识别方法汇总
2021-09-20 05:36:21
![](https://img.aspxhome.com/file/2023/6/90506_0s.png)
MySQL8.0内存相关参数总结
2024-01-26 07:37:26
python爬虫正则表达式之处理换行符
2021-02-20 05:56:02
Python线性网络实现分类糖尿病病例
2022-03-13 11:23:25
![](https://img.aspxhome.com/file/2023/9/70179_0s.png)
解决MySql8.0 查看事务隔离级别报错的问题
2024-01-17 23:14:01
![](https://img.aspxhome.com/file/2023/5/84555_0s.png)
在python中利用GDAL对tif文件进行读写的方法
2022-03-25 08:08:07
Javascript——浅析注册事件
2008-08-19 12:44:00
python和mysql交互操作实例详解【基于pymysql库】
2024-01-16 01:03:47
![](https://img.aspxhome.com/file/2023/4/79514_0s.png)
ASP开发中有用的函数(function)集合(2)
2008-10-14 17:17:00
如何用python给数据加上高斯噪声
2023-06-13 18:18:04
Python爬虫实战之虎牙视频爬取附源码
2021-04-02 01:23:27
![](https://img.aspxhome.com/file/2023/9/64269_0s.png)
基于Python编写简易版的天天跑酷游戏的示例代码
2023-10-23 01:10:11
![](https://img.aspxhome.com/file/2023/5/99405_0s.jpg)
如何禁止搜索引擎收录你的网站
2008-10-20 12:57:00
Python爬虫爬取微信朋友圈
2021-11-12 17:38:14
![](https://img.aspxhome.com/file/2023/1/76811_0s.jpg)
golang 实现interface{}转其他类型操作
2024-05-09 09:31:23