python 判断参数为Nonetype类型或空的实例
时间:2020-11-19 18:04:20|栏目:Python代码|点击: 次
Nonetype和空值是不一致的,可以理解为Nonetype为不存在这个参数,空值表示参数存在,但是值为空
判断方式如下:
if hostip is None:
print "no hostip,is nonetype"
elif hostip:
print "hostip is not null"
else:
print " hostip is null"






