【发布时间】:2018-10-21 19:51:21
【问题描述】:
我的代码有问题,我只想将结果写入 csv 并得到IndexError
seleksi = []
p = FeatureSelection(fiturs, docs)
seleksi[0] = p.select()
with open('test.csv','wb') as selection:
selections = csv.writer(selection)
for x in seleksi:
selections.writerow(selections)
在 p.select 中是:
['A',1]
['B',2]
['C',3]
etc
我得到了错误:
seleksi[0] = p.select()
IndexError: list assignment index out of range
Process finished with exit code 1
我该怎么办?
【问题讨论】:
-
这条线是做什么的
seleksi[0] = p.select()?
标签: python python-2.7