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

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


咨詢
建站咨詢
