暂无 | 130474

List-检测-not

not语句可以检查某个元素不在列表里。如下:
nums = [1, 2, 3]
print(not 4 in nums)
print(4 not in nums)
print(not 3 in nums)
print(3 not in nums)
 
结果:
>>>
True
True
False
False
>>>

1

发表评论

    评价:
    Rich Text Editor
    最新评论