Python 运算符,,特殊的算数运算符运算


特殊的算数运算符

运算符描述
/除,返回值是浮点型
//整除,结果向下取整
**乘方,2**3 #8

以上算术运算符均有对应的赋值运算符:

/= //= **=

逻辑运算符

返回值均为bool型。

运算符描述
and与,x and y
or或,x or y
not非,not x

成员运算符

适用于字符串,列表或元组的成员判断,返回值均为bool型。

运算符描述
inx in y
not inx not in y

Python 运算符

评论关闭