我有无法解决的问题。我收到错误
UnboundLocalError:赋值前引用了局部变量“检查”
我的代码
def volume_checker_first_stage(volume1,volume2,withdraw_minimun):
if volume1>volume2:
quantity = volume2
if quantity > withdraw_minimun:
checking = True
return quantity, checking
elif volume2>volume1:
quantity = volume1
if quantity > withdraw_minimun:
checking = True
return quantity, checking
else:
return None,None
作为函数体的第一行,代码如下:
checking = False
您有一个return
返回 值的语句checking
,但您的代码并不总是设置它。Referenced before assignment
意味着您的return
语句在您的代码分配变量之前询问变量的值。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句