python中的增量赋值 **=

来源:互联网 发布:流程优化那点事 编辑:程序博客网 时间:2024/06/16 23:35

这其中可以使用的有以下几种:

+=

-=

*=

/=

%=

**=

<<=

>>=

&=

^=

|=

#coding:utf-8a=2a**=2print a#output 4a+=2print a#output 6#这是左移运算符b=2b<<=2print b#output 0010 -> 1000 ,2 -> 8c=1c|=2print c# output 3 或运算 0001 | 0010 = 0011  



0 0
原创粉丝点击