(三)Python运算符

一、python运算符相关

          Python语言支持以下类型的运算符:

1、python算数运算符

2、python比较运算符

3、赋值运算符

4、python逻辑运算符

5、python位运算符

6、python成员运算符

7、python身份运算符

二、python运算符的优先级

以下表格列出了从最高到最低优先级的所有运算符:

运算符描述
** 指数 (最高优先级)
~ + - 按位翻转, 一元加号和减号 (最后两个的方法名为 +@ 和 -@)
* / % // 乘,除,取模和取整除
+ - 加法减法
>> << 右移,左移运算符
& 位 'AND'
^ | 位运算符
<= < > >= 比较运算符
<> == != 等于运算符
= %= /= //= -= += *= **= 赋值运算符
is is not 身份运算符
in not in 成员运算符
not or and 逻辑运算符
原文地址:https://www.cnblogs.com/Mr-wx/p/8452644.html