Python/gloss python assignment operators

来自菜鸟教程
跳转至:导航、​搜索

<languages />

Python赋值运算符

Python赋值运算符

赋值运算符用于为变量赋值:

操作者 和...一样 试试吧
= x = 5 x = 5 试试吧 ”
+= x + = 3 x = x + 3 试试吧 ”
-= x-= 3 x = x-3 试试吧 ”
*= x * = 3 x = x * 3 试试吧 ”
/= x / = 3 x = x / 3 试试吧 ”
%= x%= 3 x = x%3 试试吧 ”
//= x // = 3 x = x // 3 试试吧 ”
**= x ** = 3 x = x ** 3 试试吧 ”
&= x&= 3 x = x&3 试试吧 ”
= = 3 3 试试吧 ”
^= x ^ = 3 x = x ^ 3 试试吧 ”
>> = x >> = 3 x = x >> 3 试试吧 ”
<< = x << = 3 x = x << 3 试试吧 ”