0x00 错误
Traceback (most recent call last):
File "/Users/apple/Desktop/Me/Python3/MyCode/kc_v2.py", line 513, in <module>
get_data()
File "/Users/apple/Desktop/Me/Python3/MyCode/kc_v2.py", line 34, in get_rich
query_v1()
File "/Users/apple/Desktop/Me/Python3/MyCode/kc_v2.py", line 68, in query_v1
query_v12(sub, arr, '第一组')
File "/Users/apple/Desktop/Me/Python3/MyCode/kc_v2.py", line 418, in query_v12
print('666 =', type(str2))
TypeError: 'str' object is not callable
出现这个情况错误一般是:
a.
str变量
重复定义
b.
变量
重复定义
c.
函数
或者
字符串调用
错误
0x01 原因
for type in list:
# blablabla
# ....
# ....
# 省略大量代码
# 代码某个地方调用了系统的 type() 函数,导致了这个错误
type(str1)
又是
局部变量
覆盖了
系统函数
跟之前写的一篇报错文章一样
Python UnboundLocalError: local variable ‘str‘ referenced before assignment