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')
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/222015.html原文链接:https://javaforall.net
