网络编程
位置:首页>> 网络编程>> Python编程>> python 判断参数为Nonetype类型或空的实例

python 判断参数为Nonetype类型或空的实例

作者:云中不知人  发布时间:2021-03-21 07:15:17 

标签:python,Nonetype

Nonetype和空值是不一致的,可以理解为Nonetype为不存在这个参数,空值表示参数存在,但是值为空

判断方式如下:


if hostip is None:
   print "no hostip,is nonetype"
elif hostip:
   print "hostip is not null"
else:
   print " hostip is null"

来源:https://blog.csdn.net/u011085172/article/details/70911949

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com