亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

整理Python中的賦值運(yùn)算符

 更新時(shí)間:2015年05月13日 12:10:25   投稿:goldensun  
這篇文章主要介紹了Python中的賦值運(yùn)算符,其使用是Python的基本功,需要的朋友可以參考下

下表列出了所有Python語(yǔ)言支持的賦值運(yùn)算符。假設(shè)變量a持有10和變量b持有20,則:

2015513121006816.jpg (592×562)

 例如:

試試下面的例子就明白了所有在Python編程語(yǔ)言可供選擇的賦值運(yùn)算符:

#!/usr/bin/python

a = 21
b = 10
c = 0

c = a + b
print "Line 1 - Value of c is ", c

c += a
print "Line 2 - Value of c is ", c 

c *= a
print "Line 3 - Value of c is ", c 

c /= a 
print "Line 4 - Value of c is ", c 

c = 2
c %= a
print "Line 5 - Value of c is ", c

c **= a
print "Line 6 - Value of c is ", c

c //= a
print "Line 7 - Value of c is ", c

當(dāng)執(zhí)行上面的程序,它會(huì)產(chǎn)生以下結(jié)果:

Line 1 - Value of c is 31
Line 2 - Value of c is 52
Line 3 - Value of c is 1092
Line 4 - Value of c is 52
Line 5 - Value of c is 2
Line 6 - Value of c is 2097152
Line 7 - Value of c is 99864

相關(guān)文章

最新評(píng)論