【发布时间】:2012-06-11 12:10:42
【问题描述】:
我有 5 个文本文件需要存储在数组中。我试过这样。
f=[]
f[0]=open('E:/cyg/home/Aiurea/workspace/nCompare5w5.txt','r')
f[1]=open('E:/cyg/home/Aiurea/workspace/nCompare5w10.txt','r')
f[2]=open('E:/cyg/home/Aiurea/workspace/nCompare5w20.txt','r')
f[3]=open('E:/cyg/home/Aiurea/workspace/nCompare5w50.txt','r')
f[4]=open('E:/cyg/home/Aiurea/workspace/nCompare5w80.txt','r')
for i in range(5):
f[i].close()
错误信息是“IndexError: list assignment index out of range”
【问题讨论】: