Python3 错误 UnboundLocalError local variable referenced 2019-09-19 #Python 这个错误是没有定义全局变量,定义一下全局变量即可。 参考 function - Python 3: UnboundLocalError: local variable referenced before assignment - Stack Overflow function - Python 3: UnboundLocalError: local variable referenced before assignment - Stack Overflow