Posts Tagged ‘error’

1)这种情况是自己碰到的,我把代码精简了一下,举个列子 >>> def max(a): …     if a > 0: …         b = 1 …     print b … >>> max(1) 1 >>> max(0) Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “<stdin>”, line 4, in max UnboundLocalError: local variable ‘b’ referenced before assignment 上面的代码中,当a大于 0的时候,不会出现问题,但当a不大于0的时候,就报错了。 这种错误当代码少的时候容易发现,比较难办的就是,当你的代码很多,然后中间隔了很多 [...]

Thursday, July 15th, 2010 at 15:34 | 1 comment
Categories: 技术
Tags: ,
TOP