5.7 函数返回值之None类型
一、None类型
如果函数没有使用return返回数据,则会有一个None的字面量返回
案例
def say_hi(): print("你好") result = say_hi() print("返回值是:", result) if result == None: print("无返回值")用途:
函数返回值
if判断(False)
变量定义
Last updated
Was this helpful?
如果函数没有使用return返回数据,则会有一个None的字面量返回
案例
def say_hi():
print("你好")
result = say_hi()
print("返回值是:", result)
if result == None:
print("无返回值")用途:
函数返回值
if判断(False)
变量定义
Last updated
Was this helpful?
Was this helpful?