我也打算开始写博客啦!记录一下自己的学习过程~

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, }
(2)Format
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的更多相关文章

  1. python学习笔记01:安装python

    下载python: 从从https://www.python.org/downloads/下载python,根据操作系统的不同,选择不同的版本下载.注意:linux系统大多预装了python,可以直接 ...

  2. Python之行-01之初识python

    本文介绍 1.python由来与发展2.编程语言排行榜3.python环境安装4.python变量的使用5.python的注释6.用户交互输入7.python的数据类型8.python的运算符9.py ...

  3. PyCharm 中文教程 01:运行 Python 的四种方式

    <PyCharm 中文指南>在线阅读: http://pycharm.iswbm.com/ Github 项目主页: https://github.com/iswbm/pych... 1. ...

  4. Python数学建模-01.新手必读

    Python 完全可以满足数学建模的需要. Python 是数学建模的最佳选择之一,而且在其它工作中也无所不能. 『Python 数学建模 @ Youcans』带你从数模小白成为国赛达人. 1. 数学 ...

  5. Python小白的数学建模课-05.0-1规划

    0-1 规划不仅是数模竞赛中的常见题型,也具有重要的现实意义. 双十一促销中网购平台要求二选一,就是互斥的决策问题,可以用 0-1规划建模. 小白学习 0-1 规划,首先要学会识别 0-1规划,学习将 ...

  6. python学习笔记(python简史)

    一.python介绍 python的创始人为吉多·范罗苏姆(Guido van Rossum) 目前python主要应用领域: ·云计算 ·WEB开发 ·科学运算.人工智能 ·系统运维 ·金融:量化交 ...

  7. python教程与资料

    网上有个人写的python快速教程,非常好.比看书好多了.猛击下面的链接地址 http://www.douban.com/group/topic/30008503/ python文档资料收集 pyth ...

  8. 【Python大系】Python快速教程

    感谢原作者:Vamei 出处:http://www.cnblogs.com/vamei 怎么能快速地掌握Python?这是和朋友闲聊时谈起的问题. Python包含的内容很多,加上各种标准库.拓展库, ...

  9. 推荐一些python Beautiful Soup学习网址

    前言:这几天忙着写分析报告,实在没精力去研究django,虽然抽时间去看了几遍中文文档,还是等实际实践后写几篇操作文章吧! 正文:以下是本人前段时间学习bs4库找的一些网址,在学习的可以参考下,有点多 ...

随机推荐

  1. 【JAVA】String[]配列の相関

    配列の作成: ①String[] str = new String[5]; ②String[] str = new String[]{"","","& ...

  2. 2019-04(2)Python学习

    一.元组 1.什么是元组? 元组是一个固定长度,不可改变的Python序列对象.创建元组的最简单方式,是用逗号分隔一列值: In [1]: tup = 4, 5, 6 In [2]: tup Out[ ...

  3. 编写一个lambda,接受两个int,返回它们的和

    void counter(int i, int b) { auto count = [i,b]{ return i + b; }; cout<< count(); } int main() ...

  4. 阿里巴巴开源 Spring Cloud Alibaba,加码微服务生态建设

    本周,Spring Cloud联合创始人Spencer Gibb在Spring官网的博客页面宣布:阿里巴巴开源 Spring Cloud Alibaba,并发布了首个预览版本.随后,Spring Cl ...

  5. stark组件开发之组合搜索基本显示

    数据的获取,上一篇,已经有了!然后就是,如何进行展示的问题.到了展示这里,又有了新的问题, 因为从数据库,取得的数据. 分为 queryset 和 tuple 两种数据结构.tuple 中,只是字符串 ...

  6. C# 小数点后保留两位小数,四舍五入的函数及使用方法

    1 Math.Round(45.367,2) //Returns 45.37 2 Math.Round(45.365,2) //Returns 45.36 C#中的Round()不是我们中国人理解的四 ...

  7. 通过url获取bitmap

    //通过Uri获取BitMap public static Bitmap getBitmapFromUri(Uri uri,Context context) { Bitmap bitmap = nul ...

  8. github 生成配置ssh 秘钥方法详解

    如果安装github成功后,当从本地提交文件到github的时候,提交不成功,报错,可能问题就是你还没有生成ssh秘钥 1.当你提交文件到github,不成功,出现如下的情况,就代表着github上面 ...

  9. [Draft]iOS.Architecture.16.Truth-information-flow-and-clear-responsibilities-immutability

    Concept: Truth, Information Flow, Clear Responsibilities and Immutability 1. Truth 1.1 Single Source ...

  10. MySQL函数转储存(当前月数据同步)

    BEGIN declare a1 int default 0;#第一次循环的循环变量 declare a2 int default 0; declare b1 int default 0; decla ...