如何在初始化线程时将参数传递给类?



我试图调用类的数量等于表中的行数,并将参数传递到那里。但是我得到了一个错误

NameError: name 'iterr' is not defined. Did you mean: 'iter'?
class App(iterr):
def __init__(self):

if __name__ == '__main__':
table = open('config/url.txt', encoding = 'utf-8')
table_url = ''
for u in table:
table_url = u
gc = gspread.service_account(filename='config/auth.json')
sh = gc.open_by_url(table_url)
worksheet = sh.get_worksheet(0)
values_list = worksheet.col_values(1)
threads = len(values_list)
i = 1
while i < threads+1:
thread = threading.Thread(target=App, args=(i,))
thread.start()

将参数传递给init函数。

class App():
def __init__(self, iterr):

最新更新