我认为这里的代码非常草率:
industry = []
headquarters = []
specialties = []
totalEmployeeCount = []
growth6Mth = []
website = []
for i in cvs_data:
j = ci_data[0]
for j in ci_data:
if i['companyName'] == j['name']:
industry.append(Cell(row = cvs_data.index(i)+2, col = 6,
value = j['industry']))
headquarters.append(Cell(row = cvs_data.index(i)+2, col = 8,
value = j['headquarters']))
specialties.append(Cell(row = cvs_data.index(i)+2, col = 9,
value = j['specialties']))
totalEmployeeCount.append(Cell(row = cvs_data.index(i)+2, col = 10,
value = j['totalEmployeeCount']))
growth6Mth.append(Cell(row = cvs_data.index(i)+2, col = 11,
value = j['growth6Mth']))
website.append(Cell(row = cvs_data.index(i)+2, col = 14,
value = j['website']))
cvs.update_cells(industry)
cvs.update_cells(headquarters)
cvs.update_cells(specialties)
cvs.update_cells(totalEmployeeCount)
cvs.update_cells(growth6Mth)
cvs.update_cells(website)
其中 cvs_data 是用于其索引的字典列表。实际的 gspread 工作表 (cvs) 将使用 ci_data(另一个字典列表)中的值进行更新。
我猜我的搜索也可能会更好。
是否可以将所有这些值(即行业、总部等)附加到一个字典中而不是单独的列表中,然后对该字典调用 update_cells() ?
HUH函数
相关分类