新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)Python教程:python判斷列表值是否為空
python中判斷一個(gè)列表是否為空,可以使用以下方法

創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比青陽(yáng)網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫(kù),直接使用。一站式青陽(yáng)網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋青陽(yáng)地區(qū)。費(fèi)用合理售后完善,十載實(shí)體公司更值得信賴。
1、is not None 判斷
列表不為空
list_1 = []
if list_1 is not None:
print('list is not none')
列表為空
list_1 = []
if list_1[0] is None:
print('list_1 is none')
推薦學(xué)習(xí)《python教程》
2.if 列表判斷
列表不為空(空列表等于 False)
list_2 = []
if list_2:
print('list_2 is not none')
3.length列表長(zhǎng)度判斷
列表為空
list_3 = []
if len(list_3) == 0:
print('list_3 is none')
list_3 = []
if len(list):
print('list_3 is not none') 文章題目:創(chuàng)新互聯(lián)Python教程:python判斷列表值是否為空
瀏覽地址:http://www.dlmjj.cn/article/cocepco.html


咨詢
建站咨詢
