- 1.boll值类型只有两个只 (True , False ) #布尔值
- str int bool 三种数据类型之间的转换
- str() int() bool() 本身是内置函数
- str--->int a="1314520" 元素必须是数字,否则报错
- str--->bool 空串是False 不为空全部为True
- int--->bool o为False , 非0全部为True
- bool--->int True是1 False是0
- bool--->str "True", "False"
2.#比较运算符
- == 比较两个对象的值是否相同
- is 比较两个内存地址是否相同
- 看内存的方法 id(对象)
3.逻辑运算符
-
x and y, x为真,值是y,x为假,值是xx or y , x为真,值就是x,x为假,值是y比较运算符优先级高于逻辑运算符()>not >and >or如果优先级在同一级,从左往右依次执行练习题:8 and 60 and 86 or 50 or 77 or 6 and 8 77 or 6 and 8 and 9 77 or 6 and 0 and 9 7
-
4.算数运算符 + - * / %取余 **平方 //取整
-
5.成员运算符 in,not in现在学的只有字符串 xin y, y中是否包含x6.赋值运算= += -= /= %= **= //=学到的内置函数print()input()type()int()str()bool()
-
小数据池:只在str,int中存在
-
小数据池的作用: (为了节省内存而存在)
-
数据 -5---256 之间的值共用一个内存地址
-
str, 空或者一位(包括特殊字符)也是共用一个内存
-
如果多位并且包括特殊字符不共用内存
-
为空时,true
在python交互式时,变量可以直接输出,不用借助print