Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人可以解释以下内容吗?
>>> a = {1} >>> b = {2} >>> a & b == set() True >>> a & b == {} False
为什么会做出这个选择?
您的代码a & b == {}将 a ANDed 与 b 与{}空字典进行比较。因此,and 和空字典的结果不同,结果为假。
a & b == {}
{}