python判断参数为Nonetype类型或空的实例
Nonetype和空值是不⼀致的,可以理解为Nonetype为不存在这个参数,空值表⽰参数存在,但是值为空
python正则表达式爬虫
判断⽅式如下:
if hostip is None:
print "no hostip,is nonetype"
elif hostip:
print "hostip is not null"
else:
print " hostip is null"
以上这篇python 判断参数为Nonetype类型或空的实例就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。