国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

教你一招判斷Python-列表是否為空,很關(guān)鍵必須要學好

2021-04-08 17:02 作者:薇薇說UG  | 我要投稿


  1. 其他表對比判斷

列表不為空:
list_1?=?[1,2]list_2 =?[]if list_1?!= list_2:? ?print('list is not none')?列表為空:
list_1?=?[]list_2 =?[]
if list_1==list_2:
print('list_1?is none')

2.if 列表判斷

列表不為空(空列表等于 False)

list_2?=?[1,2]

if list_2:

print('list_2?is not none')


列表為空:

list_2?=?[]

if?not list_2:

print('list_2?is none')

3.length列表長度判斷

列表為空:

list_3?=?[]

if?len(list_3) ==?0:

print('list_3?is none')

列表不為空:

list_3 = [1,2]

if?len(list_3):

print('list_3 is not none')



教你一招判斷Python-列表是否為空,很關(guān)鍵必須要學好的評論 (共 條)

分享到微博請遵守國家法律
辽源市| 祁阳县| 巩留县| 美姑县| 林芝县| 永寿县| 青神县| 揭西县| 六安市| 平阴县| 盐山县| 平昌县| 偃师市| 鄂尔多斯市| 如皋市| 香格里拉县| 衡山县| 磐安县| 邢台县| 巨鹿县| 大化| 措勤县| 泗阳县| 安徽省| 郴州市| 阆中市| 永兴县| 进贤县| 南木林县| 湘西| 桐庐县| 中江县| 柳江县| 开封县| 南涧| 东源县| 仙游县| 清水县| 徐闻县| 金湖县| 巫溪县|