在以下代码片段中:
def func_5_2(datei, num):
import linecache
i = 0
number = num + 1
l = []
while True:
l[i] = linecache.getline(datei, number)
if (l[i] == ''):
break
是否可以解决我在这条线上遇到的问题?
list[i] = linecache.getline(datei, number)
这是我得到的错误:
File "/home/user/gosection.py", line 27, in func_5_2
list[i] = linecache.getline(datei, number)
TypeError: 'type' object does not support item assignment
谢谢你的帮助!