python——基础学习篇(1)

占位符 %d是整型,%f是浮点型,%s是字符串

格式化方法不能控制精确度

 

divmod(3,2)——(1,1)地板除

布尔类型ture/flase

flase情况很少{none和flase,值为0的数字类型(0,0.0,0j),空集和空序列(){},}

fraction(0,1)分子为0,分母为1  (1=true,0=flase)ture-flase=1

逻辑运算 and:得满足左右都是ture

                or: 只需要一个为true

               not:得到相反的值

短路逻辑:and两边都为true输出后面    (3 and 4 ——4)如果左边不为true,左出右不看(0 and 3——0)

                   or如果左为true,右不管     (3 or 4 ——3)  如果左不为true,则右出 (0 or 3 ——3)

运算符优先级 not>and>or

(not 1) or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9=4

flase or 0 = 0  

·python 中的可迭代对象 :字符串 , 列表 ,元组 ,字典 ,集合

Ctrl + shift + f    —— 全局关键字搜索

ctrl + shift +  r ——全局替换

alt + p 重复上面的程序

ctrl + x  删除整行代码

ctrl + alt + L   将当前文件格式化(更美观)

ctrl + E  快速查找最近编码的文本

 

posted @ 2023-11-03 23:30  |小菜狗|  阅读(25)  评论(0)    收藏  举报