0x00 错误
0x01 代码
代码:
数字转字符串不就是这样么?
全局搜索了一下代码
原来在后面定义了一个 str
变量
这个变量,覆盖了系统的类 str
所以,导致了
UnboundLocalError: local variable 'str' referenced before assignment
0x02 办法
既然是命名覆盖,那就换个名字好了~
要注意的一件事情是:
不要跟系统的类重名了!
😂😂
小笔记应用
代码:
数字转字符串不就是这样么?
全局搜索了一下代码
原来在后面定义了一个 str
变量
这个变量,覆盖了系统的类 str
所以,导致了
UnboundLocalError: local variable 'str' referenced before assignment
既然是命名覆盖,那就换个名字好了~
要注意的一件事情是:
不要跟系统的类重名了!
😂😂
下一篇:【二叉树】开幕式焰火
linux本地repo 搭建
python UnboundLocalError 错误
python UnboundLocalError: local variable '****' referenced before assignment 报错的解决方法:运行如下python代码会报错:UnboundLocalError: local variable 'val' referenced before assignment翻译:本地变量val引用前没有定义一 、报错原因这
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M