None
# None
None
是内置常量,是NoneType
的唯一真值。None
经常用于表示缺少值。
python中None
的典型用法:
定义函数时的默认参数占位符
>>> def func(x, y=None):
pass
1
2
2
如果函数没有返回值默认会返回None
>>> def func():
pass
>>> res = func()
>>> print(res)
None
1
2
3
4
5
2
3
4
5
本文完,感谢你的耐心阅读,如有需要可加我微信,备注「博客」并说明原因,我们一起进步,下次见。

上次更新: 2022/12/15, 21:20:30