1、str(),int(),float(),bool() 类型转换
eg:
a=‘520’ b=int(a) b=520
str(5e19) : ‘5e+19’
int(‘小甲鱼’) 错误
2、e记法,科学计数法,15000:1.5e4 0.00006:6e-5
3、布尔类型 true:1 flase:0
4、type() 看是什么类型的
eg:
type(520) int型
type(‘888’) str型
type(true) bool型
5、isinstance(1,a) 判断a的类型是不是和1这个整型相同,结果时true或者
flase
6、python与C语言算术运算符不同的:
C语言里的除法是地板除法,python里的 /= 不是,比如10/=8 值为1.25
python里的地板除法是 // 这才和C语言相同 10/=8 值为 1
幂运算符** 3**2=9 的优先级比其左侧的高,比起右侧的低,比如:
-3**2 相当于 -(3**2)=-9
3** -2相当于 3**(-2) =0.111111111
7、python 的逻辑运算符直接用 and,or,not
3<4<5这个算式在python中是行得通的,相当于3<4 and 4<5
8、打飞机框架