首页 > 其他分享 >NoneType

NoneType

时间:2022-08-19 17:57:47浏览次数:130  
标签:None res NoneType func pass def

None是内置常量,是NoneType的唯一真值。None经常用于表示缺少值。

python中None的典型用法:

  • 定义函数时的默认参数占位符
>>> def func(x, y=None):
        pass
  • 如果函数没有返回值默认会返回None
>>> def func():
        pass
>>> res = func()
>>> print(res)
None     

标签:None,res,NoneType,func,pass,def
From: https://www.cnblogs.com/superwuchaofan/p/16562464.html

相关文章