作者:手机用户2502900723 | 来源:互联网 | 2023-06-27 15:49
Ifoundthiskindofexpressionseveraltimesinapythonprogram:我在python程序中多次发现这种表达式:ifvariabl
I found this kind of expression several times in a python program:
我在python程序中多次发现这种表达式:
if variable is not None:
dothings(variable)
It seems strange to me, and I think that it has no more sense than:
这对我来说似乎很奇怪,我认为它没有比以下更有意义了:
if variable:
dothings(variable)
Maybe I don't know Python enough, and the expression is explained somewhere?
也许我不太了解Python,并且表达式在某处被解释了?
4 个解决方案