python nonetype怎么判断
lewis
2017-05-05
21次阅读
在Python中,可以使用type()函数来判断一个变量的类型。如果变量是None类型,即NoneType,type()函数将返回NoneType。例如:
x = None
if type(x) == type(None):
print("x is NoneType")
else:
print("x is not NoneType")
输出结果为:
x is NoneType

发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。