Python 关键字 None
定义和用法
None关键字被用于定义一个空值,或根本没有任何值。
None与0,False或空字符串不同。None是自己的数据类型(NoneType),只有None可以是None。
更多实例
实例
做一个布尔值测试,会发生什么?无正确或错误:x = None
if x:
print("Do you think None is True")
else:
print("None is not True...")
运行实例»None关键字被用于定义一个空值,或根本没有任何值。
None与0,False或空字符串不同。None是自己的数据类型(NoneType),只有None可以是None。
x = None
if x:
print("Do you think None is True")
else:
print("None is not True...")
运行实例»