<class list =“”> object和xslxwriter错误

时间:2018-05-06 14:48:18

标签: python data-structures typeerror nested-lists

想要创建一个从晨星下载财务密钥比率的脚本。我使用github xlsxwriter和早安模块,但有一个问题(python新手)。 kr_ratios的数据结构是。我无法将其转换为普通类型,因此无法写入.xlsx文件。另外,如何在kr_ratios中找到子列表的名称?我有以下代码:

import good_morning as gm
import csv
import xlsxwriter

with open('greekstocks.csv', newline='') as File:  
  reader = csv.reader(File)
  dataa=[]
  for i in reader:
    dataa.extend(i)

workbook = xlsxwriter.Workbook('Financials_GR.xlsx')

for tick in dataa[1:2]:
   kr = gm.KeyRatiosDownloader()
   kr_ratios = kr.download(tick)
   worksheet1 = workbook.add_worksheet()
   worksheet1.write('A1:FG:1000',kr_ratios)


workbook.close()

错误是:

TypeError: Unsupported type <class 'list'> in write()

0 个答案:

没有答案