Search code examples
pythonsyntax-error

why I am getting the following when there is no problem with spaces?


I am trying to run the following code. I checked 4 tabs after for but still I am getting error: IndentationError: expected an indented block .

    # writing vectors(inverse indexing) of top_k_terms in ranks.txt
f = open("ranks.txt",'w')                                       
for i in range(len(top_k_terms)):
    pickle.dump((newInverseIndexingDict[top_k_terms[i]]),f)
f.close()

if you need to know what is newInverseIndexingDict[top_k_terms[i]], for i=0 it is

[0.0, 0.7959605415681652, 0.0]

and so on.


Solution

  • Python even checks the indentation of comments, unfortunately.