Python对象不能解释为索引

iMi*_*Mix 0 python list object typeerror

运行下面的代码

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
Run Code Online (Sandbox Code Playgroud)

我有这个例外:

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
Run Code Online (Sandbox Code Playgroud)

我找不到我的代码有什么问题.任何帮助将不胜感激.

zha*_*gwt 6

似乎在第22行c = Client.Client(proxySplit[0], proxySplit[1], uid, ok, 171147281)你创造c了一个物体,而不是它int.当它再次进入第20行时,将c被用作索引,这是不允许的.