gpt4 book ai didi

python - python异常情况下的变量范围

转载 作者:太空狗 更新时间:2023-10-30 02:41:15 25 4
gpt4 key购买 nike

<分区>

while True:
try:
2/0
except Exception as e:
break

print e

给出:整数除法或除以零的模数

我认为 e 的范围在 while block 内,并且在外部 print 语句中将无法访问它。我错过了什么?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com