UnboundLocalError: local variable 'a' referenced before assignment
(1)下面这种情况是不会报错的:
>>> x = 10
>>> def bar():
... print(x)
>>> bar()
10
(2)但是这种情况就会报UnboundLocalError的错误:
>>> x =
原创
2018-09-21 16:49:04 ·
4802 阅读 ·
0 评论