小编Age*_*ote的帖子

为什么显式测试空集不起作用

如果为空set()的False,不应该if test == False在下面的代码条款计算为True?

test = set() 

#  empty sets are false
if test == False:
    print("set is empty")
else:
    print("set NOT empty")

if not test:
    print("set is empty")
Run Code Online (Sandbox Code Playgroud)

输出继电器:

set NOT empty
set is empty
Run Code Online (Sandbox Code Playgroud)

python python-3.x

10
推荐指数
2
解决办法
1420
查看次数

标签 统计

python ×1

python-3.x ×1