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 ...
随机推荐
- js数组学习整理
原文地址:js数组学习整理 常用的js数组操作方法及原理 1.声明数组的方式 var colors = new Array();//空的数组 var colors = new Array(3); // ...
- C#创建、安装、卸载、调试Windows Service(Windows 服务)的简单教程
前言:Microsoft Windows 服务能够创建在它们自己的 Windows 会话中可长时间运行的可执行应用程序.这些服务可以在计算机启动时自动启动,可以暂停和重新启动而且不显示任何用户界面.这 ...
- Android之数据存储的五种方法
1.Android数据存储的五种方法 (1)SharedPreferences数据存储 详情介绍:http://www.cnblogs.com/zhangmiao14/p/6201900.html 优 ...
- VS2015墙内创建ionic2
开始学习ionic2,试验各种方法,感觉以下是紧跟rc版本的最佳方案 STEP1 设置cnpm npm install -g cnpm --registry=https://registry.npm. ...
- 【Update】C# 批量插入数据 SqlBulkCopy
SqlBulkCopy的原理就是通过在客户端把数据都缓存在table中,然后利用SqlBulkCopy一次性把table中的数据插入到数据库中. SqlConnection sqlConn = new ...
- Configure a bridged network interface for KVM using RHEL 5.4 or later?
environment Red Hat Enterprise Linux 5.4 or later Red Hat Enterprise Linux 6.0 or later KVM virtual ...
- BZOJ 1146: [CTSC2008]网络管理Network [树上带修改主席树]
1146: [CTSC2008]网络管理Network Time Limit: 50 Sec Memory Limit: 162 MBSubmit: 3522 Solved: 1041[Submi ...
- 使用PushSharp给iOS应用推送消息
PushSharp是一个C#编写的服务端类库,用于推送消息到各种客户端,支持iOS(iPhone/iPad).Android.Windows Phone.Windows 8.Amazo.Blackbe ...
- 自定义Angular插件 - 网站用户引导
最近由于项目进行了较大的改版,为了让用户能够适应这次新的改版,因此在系统中引入了“用户引导”功能,对于初次进入系统的用户一些简单的使用培训training.对于大多数网站来说,这是一个很常见的功能.所 ...
- Windows10自适应和交互式toast通知[1]
阅读目录: 概述 toast通知的结构 视觉区域(Visual) 行为(Actions) 特定场景下的Toast通知 带多内容的通知 带行为的通知(例子1) 带行为的通知(例子2) 带文本输入框和行为 ...