我在下面的代碼中不斷收到「lijst2 = lijst + [cat]」這一行的錯誤「意外縮進」。我不知道爲什麼,因爲據我所見,縮進似乎是正確的?請記住我是初學者。謝謝!這是我的代碼:意外的縮進Python
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)
你可能混合空格和製表符。 – sloth 2013-05-06 08:58:02
看起來'lijst'應該是'lijst1'。如果您評論該行,該怎麼辦? – konjac 2013-05-06 08:59:11
從[PEP-8風格指南](http://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) - 切勿混合製表符和空格。 – 2013-05-06 08:59:12