运行以下代码
import threading
import io
import Client
Proxies = None
Users = None
with open("proxies.txt") as x:
Proxies = x.readlines()
with open("ids.txt") as f:
Users = f.readlines()
c = 0
for udata in Users:
uid = udata.split(':')[0]
ok = udata.split(':')[1]
while True:
proxy = Proxies[c].strip('\n')
proxySplit = proxy.split(':')
c = Client.Client(proxySplit[0], proxySplit[1], uid, ok, 171147281)
if(c):
c += 1
break
我有这个例外:
Traceback (most recent call last):
File "Run.py", line 20, in <module>
proxy = str(Proxies[c]).strip('\n')
TypeError: object cannot be interpreted as an index
我无法找到我的代码有什么问题。任何帮助将不胜感激。
答案 0 :(得分:6)
似乎在第22行c = Client.Client(proxySplit[0], proxySplit[1], uid, ok, 171147281)
中,您将c
设为对象,而不再是int
。当它再次进入第20行时,c
被用作索引,这是不允许的。