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