温馨提示×

python如何结束执行函数

九三
291
2021-02-25 17:09:55
栏目: 编程语言
Python开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

python如何结束执行函数

在python中使用return语句结束执行函数,具体方法如下:

>>> def fun():

print 'ok'

>>> res=fun()

ok

>>> type(res)

>>> res==None

True

>>> def func():

print 98

return

>>> f=func()

98

>>> f

>>> type(f)

>>> f==None

True

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:python函数如何结束

0