标签:assign error 作用 pytho turn randn += ogr rand
*)matplotlib animate中变量作用域的问题
错误提示:
UnboundLocalError: local variable ‘i‘ referenced before assignment
代码:
i=0 def animate(frameno): x = mu + sigma * np.random.randn(N) n, _ = np.histogram(x, bins, normed=True) time_text.set_text(time_template%frameno) i+=1 for rect, h in zip(patches, n): rect.set_height(h) return patches
标签:assign error 作用 pytho turn randn += ogr rand
原文地址:https://www.cnblogs.com/Gaoqiking/p/11258442.html