Day01 login module
知识点:模块导入 变量赋值的两种形式 格式化输出 for循环 if...else 嵌套
#!C:\Program Files\Python35/bin
# -*- conding:utf-8 -*-
# author: Frank
import getpass
user,passwd= 'Frank','oldboy_python'
msg = '''
Information of %s person:
NAME: %s
AGE: %s
JOB: %s
ID : %s
''' %(user,user, 21, 'IT Engineer',3714)
input_time = 1
for i in range(5):
print("-----input %d time-----" %int((input_time)))
username = input("please input your name:")
# password = getpass.getpass("please input your password:")
password = input("please input your password:")
if username == user and password == passwd :
print("%s Welcom to login on" %(user))
info_confirm = input("If you need double check your personal inform yes/no:")
if info_confirm == 'yes':
print(msg)
break
else:
print("please go ahead")
break
else :
if input_time == 3:
print("Your input has 3 times wrong , your account will be locked")
exit()
else:
print("Your user or password is invalid , pleasre re_input!")
input_time += 1
测试结果:
#测试1
-----input 1 time-----
please input your name:frank
please input your password:dmfkdf
Your user or password is invalid , pleasre re_input!
-----input 2 time-----
please input your name:frank
please input your password:kdf
Your user or password is invalid , pleasre re_input!
-----input 3 time-----
please input your name:Frkdfk
please input your password:msk
Your input has 3 times wrong , your account will be locked #测试2
-----input 1 time-----
please input your name:Frank
please input your password:oldboy_python
Frank Welcom to login on
If you need double check your personal inform yes/no:yes Information of Frank person:
NAME: Frank
AGE: 21
JOB: IT Engineer
ID : 3714 # 测试3:
-----input 1 time-----
please input your name:frak
please input your password:mksf34
Your user or password is invalid , pleasre re_input!
-----input 2 time-----
please input your name:mddif
please input your password:frank3235
Your user or password is invalid , pleasre re_input!
-----input 3 time-----
please input your name:Frank
please input your password:oldboy_python
Frank Welcom to login on
If you need double check your personal inform yes/no:no
please go ahead
Day01 login module的更多相关文章
- Centos6.5 登录时,提示Module is unkown
前一段时间,因工作需要在物理机上装了一个Centos6.5,但是,用了一段时间,发现再登录时,无论如何也登不进去了,并且也不提示用户名或者密码错误.我一度以为是在profile以及.bashrc或者. ...
- [Vuex] Lazy Load a Vuex Module at Runtime using TypeScript
Sometimes we need to create modules at runtime, for example depending on a condition. We could even ...
- [Firebase] 3. Firebase Simple Login Form
Using $firebaseSimpleLogin service. Here we use three methods for login, logout, register and getCur ...
- js中的预加载与懒加载(延迟加载)
js中加载分两种:预加载与延迟加载 一. 预加载,增强用户的体验,但会加载服务器的负担.一般会使用多种 CSS(background).JS(Image).HTML(<img />) . ...
- Nodejs学习笔记(七)--- Node.js + Express 构建网站简单示例
目录 前言 新建项目.建立数据库以及其它准备工作 新建express + ejs 项目:sampleEjs 创建数据库 修改package.json文件,安装session和mysql模块 样式和JQ ...
- Spring学习笔记之整合struts
1.现有项目是通过 <action path="/aaaaAction" type="org.springframework.w ...
- IOS使用APNS推送Payload字节数限制导致推送不成功
这2天须要在推送上加上脚本,找到了badge方法能够加脚本.加上后可是怎么推送也不成功.郁闷了好久.在网上查找相关资料. 最终被我找到原因: "Payload--最多256bytes. &q ...
- Angular 2.0 从0到1 (七)
第一节:Angular 2.0 从0到1 (一)第二节:Angular 2.0 从0到1 (二)第三节:Angular 2.0 从0到1 (三)第四节:Angular 2.0 从0到1 (四)第五节: ...
- ActiveMQ(5.10.0) - Configuring the JAAS Authentication Plug-in
JAAS provides pluggable authentication, which means ActiveMQ will use the same authentication API re ...
随机推荐
- DOM、BOM 操作超级集合
本章内容: 定义 节点类型 节点关系 选择器 样式操作方法style 表格操作方法 表单操作方法 元素节点ELEMENT 属性节点attributes 文本节点TEXT 文档节点 Document 位 ...
- 如何使用swing创建一个BeatBox
首先,我们需要回顾一些内容(2017-01-04 14:32:14): 1.Swing组件 Swing的组件(component,或者称之为元件),是较widget更为正确的术语,它们就是会放在GUI ...
- 分页插件--根据Bootstrap Paginator改写的js插件
刚刚出来实习,之前实习的公司有一个分页插件,和后端的数据字典约定好了的,基本上是看不到内部是怎么实现的,新公司是做WPF的,好像对于ASP.NET的东西不多,导师扔了一个小系统给我和另一个同事,指了两 ...
- JavaScript学习笔记(四)——jQuery插件开发与发布
jQuery插件就是以jQuery库为基础衍生出来的库,jQuery插件的好处是封装功能,提高了代码的复用性,加快了开发速度,现在网络上开源的jQuery插件非常多,随着版本的不停迭代越来越稳定好用, ...
- android SystemServer.java启动的服务。
EntropyService:熵(shang)服务,用于产生随机数PowerManagerService:电源管理服务ActivityManagerService:最核心服务之一,Activity管理 ...
- Android开发学习—— 创建项目时,不是继承activity,而是继承ActionBarActivity
对于我们新建android项目时, 会 继承ActionBarActivity. 我们在新建项目时, 最小需求的sdk 选择 4.0以上版本.这样 新建的android项目就是继承activity了!
- 真正的汉化-PowerDesigner 16.5 汉化
一.背景 经常使用PowerDesigner,之前使用15版本,后来16出来后,就一直在使用16,不过一直是英文.一些同事对使用英文版总显示有些吃力. 遍寻百度.必应,都没有找到真正的针对版本16的汉 ...
- Android快乐贪吃蛇游戏实战项目开发教程-05虚拟方向键(四)四个三角形按钮
该系列教程概述与目录:http://www.cnblogs.com/chengyujia/p/5787111.html 一.如何判断点击的是哪个方向键按钮 在上篇教程中我们实现了左边的三角形按钮效果, ...
- Linux 安装Mono环境 运行ASP.NET(一)
1.先看一下Linux环境下面请求的过程,(画的不是很好,简单的了解一下原理.) .NET跨平台其实需要这三个关键:编译器.CLR和基础类库.在.NET下我们编写一个最简单的"Hello W ...
- 小丁带你走进git的世界四-重写历史记录
一.git对象文件创建 开篇先补充一个知识点,就是比如我建立一个文件之后,使用git add就会生成一个git对象,但是git对象生成后可以在.git/objects里面对应,首先我们来初始化一个仓库 ...