Python 运算符

 

需要注意的算术运算符:

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

对应的赋值运算符:

/=            //=            **=

注意:pyhton中没有++、--运算符。

逻辑运算符

返回值均为bool型。

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

成员运算符

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

运算符描述
in x  in  y
not in x not in y
原文地址:https://www.cnblogs.com/chy18883701161/p/11285917.html