国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

在Python中使用成員運(yùn)算符的示例

2019-11-25 17:29:04
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

下表列出了所有Python語(yǔ)言支持的成員運(yùn)算符。

2015513122253479.jpg (586×176)

 例如:

試試下面的例子就明白了所有的Python編程語(yǔ)言提供會(huì)員運(yùn)算符:

#!/usr/bin/pythona = 10b = 20list = [1, 2, 3, 4, 5 ];if ( a in list ):  print "Line 1 - a is available in the given list"else:  print "Line 1 - a is not available in the given list"if ( b not in list ):  print "Line 2 - b is not available in the given list"else:  print "Line 2 - b is available in the given list"a = 2if ( a in list ):  print "Line 3 - a is available in the given list"else:  print "Line 3 - a is not available in the given list"

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

Line 1 - a is not available in the given listLine 2 - b is not available in the given listLine 3 - a is available in the given list

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 衡水市| 北安市| 光山县| 海淀区| 宜良县| 吉木萨尔县| 中山市| 宣武区| 汨罗市| 大港区| 阳曲县| 新平| 康定县| 沙洋县| 寿光市| 稷山县| 鹰潭市| 应城市| 舞钢市| 大田县| 揭阳市| 淮安市| 巴中市| 台山市| 海伦市| 林口县| 鹤山市| 兰西县| 临桂县| 吉林市| 寻乌县| 繁昌县| 辛集市| 泸溪县| 乌拉特后旗| 江西省| 分宜县| 和田市| 乌恰县| 上思县| 阳西县|