Python:将空字符串与False进行比较是假的,为什么?

问题描述 投票:3回答:5

如果not ''评估为True,为什么'' == False评估为False

例如,与True相比,其他类型的“空洞”(例如0,0.0)将返回False

>>> 0 == False
True
>>> 0.0 == False
True

谢谢

python string boolean logic
5个回答
© www.soinside.com 2019 - 2024. All rights reserved.