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 ...
随机推荐
- Oracle学习之路-- 案例分析实现行列转换的几种方式
注:本文使用的数据库表为oracle自带scott用户下的emp,dept等表结构. 通过一个例子来说明行列转换: 需求:查询每个部门中各个职位的总工资 按我们最原始的思路可能会这么写: ...
- 应该是Angular2的一个bug?
为了应对未来的趋势,及时赶上下一趟互联网技术,我最近也在通过具体项目研究angular2,首先必须要吐槽的是,学习angular2的成本本身不高,但是一堆的工具.配置实在让人 很是焦灼,就像asp.n ...
- ASP.Net MVC——使用 ITextSharp 完美解决HTML转PDF(中文也可以)
前言: 最近在做老师交代的一个在线写实验报告的小项目中,有这么个需求:把学生提交的实验报告(HTML形式)直接转成PDF,方便下载和打印. 以前都是直接用rdlc报表实现的,可这次牵扯到图片,并且更为 ...
- Android—基于微信开放平台v3SDK,开发微信支付填坑。
接触微信支付之前听说过这是一个坑,,,心里已经有了准备...我以为我没准跳坑出不来了,没有想到我填上了,调用成功之后我感觉公司所有的同事都是漂亮的,隔着北京的大雾霾我仿佛看见了太阳~~~好了,装逼结束 ...
- Atitit.软件开发的三层结构isv金字塔模型
Atitit.软件开发的三层结构isv金字塔模型 第一层,Implements 层,着重与功能的实现.. 第二次,spec层,理论层,设计规范,接口,等.流程.方法论 顶层,val层,价值观层,原则, ...
- Web应用之LAMP源码环境部署
一.LAMP环境的介绍 1.LAMP环境的重要性 思索许久,最终还是决定写一篇详细的LAMP的源码编译安装的实验文档,一来是为了给自己一个交代,把技术进行系统的归纳,将技术以极致的形式呈现出来,做为一 ...
- github入门到上传本地项目【网上资源整合】
[在原文章的基础上,修改了描述的不够详细的地方,对内容进行了扩充,整合了网上的一些资料] [内容主要来自http://www.cnblogs.com/specter45/p/github.html#g ...
- 【python之路3】if 语句
1.if语句用法(if....else....) #!/usr/bin/env python # -*- coding:utf-8 -*- my_name = raw_input("plea ...
- Storm介绍(一)
作者:Jack47 PS:如果喜欢我写的文章,欢迎关注我的微信公众账号程序员杰克,两边的文章会同步,也可以添加我的RSS订阅源. 内容简介 本文是Storm系列之一,介绍了Storm的起源,Storm ...
- 前端构建大法 Gulp 系列 (三):gulp的4个API 让你成为gulp专家
系列目录 前端构建大法 Gulp 系列 (一):为什么需要前端构建 前端构建大法 Gulp 系列 (二):为什么选择gulp 前端构建大法 Gulp 系列 (三):gulp的4个API 让你成为gul ...