错误代码门户
PythonPython错误代码

UnboundLocalError

UnboundLocalError

代码 UnboundLocalError · Python 报告的问题。

当在函数或方法中引用局部变量,但没有值绑定到该变量时引发。这是 NameError 的子类。

Google Translate · 此内容为自动翻译。技术术语及适用条件请以英文原文为准。

Raised when a reference is made to a local variable in a function or method, but no value has been bound to that variable. This is a subclass of NameError.

故障排除与诊断链接

请先确认文档中的产品、版本及发生环境与当前情况一致。