我不断收到以下代码中“lijst2 = lijst + [cat]”行的错误“unexpected indent”。我不知道为什么,因为据我所知,缩进似乎是正确的?请记住我是初学者。谢谢!这是我的代码:
for fileid in corpus.fileids():
tekst1 = corpus.words(fileid)
instantie = defaultdict(float)
cat = mijn_corpus.fileids()
for word in tekst1:
if word in freq:
instantie[word] +=1
for word in freq:
if word not in tekst1:
instantie[word] +=0
lijst1 = []
for key, value in instantie.iteritems():
lijst1.append(value)
lijst2 = lijst + [cat] # Here I get the error message: unexpected indent
resultaten.writerrow(lijst2)