# return 函数只能返回一层的值。 def top(): return 111111 def ta(): top() print(999999) return 5555555 print(ta())
2.1、
raise是提出,如:raise a question 提问题;
return是归还、回归,如:I will return the book tomorrow 我明天还书。
2.2、
def level_1():
# 这里制造了一个异常
# s = 6 / 0
# 这里指明了异常的类型,和对异常的解释说明
raise ValueError('this is a value error')
def level_2():
level_1()
print('in level 2')
def level_3():
level_2()
print('in level 3')
def top():
level_3()
print('in top')
# 上面函数的return 都不会输出
return 111
print(top())
# try:
# print(top())
# except:
# print('catch exception from level 1')
3、
4、
5、
6、
python raise用处_raise是更好的return_weixin_39888807的博客-CSDN博客https://blog.csdn.net/weixin_39888807/article/details/110128384
python中的return的返回与执行https://www.cnblogs.com/kaishirenshi/p/8617380.html