小编use*_*232的帖子

Python:是否与""相同?

我对Python和Coding比较陌生.我一直很好,直到遇到"无":

variable = None                          
while variable != "":                    
    print("Why does this loop start?")
Run Code Online (Sandbox Code Playgroud)

虽然看起来很简单但我无法理解为什么上面的循环开始了.如何None为空字符串不同?我以为他们都评价为False.

python string equality type-conversion nonetype

-1
推荐指数
2
解决办法
805
查看次数

标签 统计

equality ×1

nonetype ×1

python ×1

string ×1

type-conversion ×1