01 of lenrning python
我也打算开始写博客啦!记录一下自己的学习过程~
01密文登陆
这个在vscode中不显示密文

在cmd中看不到密码

# -*- coding: utf-8 -*-
import getpass
name = input("please input your name:")
password = getpass.getpass('please put in your password:')
if name == "xb" and password == "":
print("welcome!")
else:
print("you have put in the wrong information!")
print(name, password)
02各种变量的空值
|
数值 |
digital = 0 |
|
字符串 |
str = "" 或 str = ” |
|
列表 |
list = [] |
|
字典 |
ditc = {} |
|
元组 |
tuple= () |
03占位符
(1)%
tpl = "i am %s" % "alex"
tpl = "i am %s age %d" % ("alex", 18)
tpl = "i am %(name)s age %(age)d" % {"name": "alex", "age": 18}
tpl = "percent %.2f" % 99.97623
tpl = "i am %(pp).2f" % {"pp": 123.425556, }
tpl = "i am %.2f %%" % {"pp": 123.425556, }
tpl = "i am {}, age {}, {}".format("seven", 18, 'alex')
tpl = "i am {}, age {}, {}".format(*["seven", 18, 'alex'])
tpl = "i am {0}, age {1}, really {0}".format("seven", 18)
tpl = "i am {0}, age {1}, really {0}".format(*["seven", 18])
tpl = "i am {name}, age {age}, really {name}".format(name="seven", age=18)
tpl = "i am {name}, age {age}, really {name}".format(**{"name": "seven", "age": 18})
tpl = "i am {0[0]}, age {0[1]}, really {0[2]}".format([1, 2, 3], [11, 22, 33])
tpl = "i am {:s}, age {:d}, money {:f}".format("seven", 18, 88888.1)
tpl = "i am {:s}, age {:d}".format(*["seven", 18])
tpl = "i am {name:s}, age {age:d}".format(name="seven", age=18)
tpl = "i am {name:s}, age {age:d}".format(**{"name": "seven", "age": 18})
tpl = "numbers: {:b},{:o},{:d},{:x},{:X}, {:%}".format(15, 15, 15, 15, 15, 15.87623, 2)
tpl = "numbers: {:b},{:o},{:d},{:x},{:X}, {:%}".format(15, 15, 15, 15, 15, 15.87623, 2)
tpl = "numbers: {0:b},{0:o},{0:d},{0:x},{0:X}, {0:%}".format(15)
tpl = "numbers: {num:b},{num:o},{num:d},{num:x},{num:X}, {num:%}".format(num=15)
04登陆交互程序
# -*- coding: utf-8 -*-
print("----------welcome---------")
i = 0
LockedName = ""
name = ""
while i < 3:
name = input("please input your name:")
password = input('please put in your password:')
if name == LockedName:
print("You have been locked")
if name == "xb" and password == "":
print("-----------------")
print("welcome!")
print("name:%s,\npassword:%s" % (name, password))
exit()
else:
print("try again")
if i == 2:
LockedName = name
print("your account has been locked!!!")
i = i + 1
01 of lenrning python的更多相关文章
- python学习笔记01:安装python
下载python: 从从https://www.python.org/downloads/下载python,根据操作系统的不同,选择不同的版本下载.注意:linux系统大多预装了python,可以直接 ...
- Python之行-01之初识python
本文介绍 1.python由来与发展2.编程语言排行榜3.python环境安装4.python变量的使用5.python的注释6.用户交互输入7.python的数据类型8.python的运算符9.py ...
- PyCharm 中文教程 01:运行 Python 的四种方式
<PyCharm 中文指南>在线阅读: http://pycharm.iswbm.com/ Github 项目主页: https://github.com/iswbm/pych... 1. ...
- Python数学建模-01.新手必读
Python 完全可以满足数学建模的需要. Python 是数学建模的最佳选择之一,而且在其它工作中也无所不能. 『Python 数学建模 @ Youcans』带你从数模小白成为国赛达人. 1. 数学 ...
- Python小白的数学建模课-05.0-1规划
0-1 规划不仅是数模竞赛中的常见题型,也具有重要的现实意义. 双十一促销中网购平台要求二选一,就是互斥的决策问题,可以用 0-1规划建模. 小白学习 0-1 规划,首先要学会识别 0-1规划,学习将 ...
- python学习笔记(python简史)
一.python介绍 python的创始人为吉多·范罗苏姆(Guido van Rossum) 目前python主要应用领域: ·云计算 ·WEB开发 ·科学运算.人工智能 ·系统运维 ·金融:量化交 ...
- python教程与资料
网上有个人写的python快速教程,非常好.比看书好多了.猛击下面的链接地址 http://www.douban.com/group/topic/30008503/ python文档资料收集 pyth ...
- 【Python大系】Python快速教程
感谢原作者:Vamei 出处:http://www.cnblogs.com/vamei 怎么能快速地掌握Python?这是和朋友闲聊时谈起的问题. Python包含的内容很多,加上各种标准库.拓展库, ...
- 推荐一些python Beautiful Soup学习网址
前言:这几天忙着写分析报告,实在没精力去研究django,虽然抽时间去看了几遍中文文档,还是等实际实践后写几篇操作文章吧! 正文:以下是本人前段时间学习bs4库找的一些网址,在学习的可以参考下,有点多 ...
随机推荐
- 自定义Log 写到文件中
using System; using System.Collections.Generic; using System.Web; using System.IO; using System.Text ...
- POJ-1860.CurrencyExchange(Spfa判断负环模版题)
本题思路:每完成一次交换之后交换余额多于原钱数则存在正环,输出YES即可. 参考代码: #include <cstdio> #include <cstring> #includ ...
- 51单片机学习笔记(郭天祥版)(6)——键盘的作业题、AD、DA、DS18B20(这里之后看清翔的补一下好了)
A:analog,D:digital AD,就是模拟量转换为数字量,DA就是数字量转换为模拟量 为什么要转换? 单片机是数字芯片,内部只有0和1,没法表示模拟量 比如我们如果需要2.5V怎么办?其实是 ...
- Flask-WTForms 简单使用
安装 wtforms 2.2.1 直接上代码: app.py 文件: from flask import Flask, render_template, request from wtforms im ...
- mysql学习记录
干净卸载mysql:https://blog.csdn.net/cxy_summer/article/details/70142322mysql 解压缩版安装说明:https://jingyan.ba ...
- WCF 服务的集合管理器的设计
今天是2019年2月1日,时间过得针对,马上就年底了,当前新年也离我们越来越近了.在此,我也祝福经常浏览我博客的朋友们“新年快乐.阖家欢乐”,来年有一个好彩头.在即将结束这一年之计,写今年的最后一片文 ...
- Spring Boot Web应用开发 CORS 跨域请求支持:
Spring Boot Web应用开发 CORS 跨域请求支持: 一.Web开发经常会遇到跨域问题,解决方案有:jsonp,iframe,CORS等等CORS与JSONP相比 1. JSONP只能实现 ...
- go的包下载失败解决方案
包被墙的方案 1 翻啊的墙 2 gopm 3 https://github.com/golang/net 4 使用国内网站打包 5 export GOPROXY=https://goproxy.io
- 面试简单整理之spring、spring mvc
90.为什么要使用 spring? 解决企业应用开发的复杂性,IOC.aop 91.解释一下什么是 aop? 面向切面编程.... 92.解释一下什么是 ioc? 控制反转.. 93.spring 有 ...
- Texture转Texture2D
private Texture2D TextureToTexture2D(Texture texture) { Texture2D texture2D = new Texture2D(texture. ...