harshitha mg
harshitha mg

Reputation: 67

How to solve indentationerror

facing error like:

Indentation Error: unintended does not match any outer indentation level,

run_id =id[0]

my code goes like this

else:

                    run_id = id[0]

                    runid_list.append(str(run_id))

                cur.execute("SELECT testcases.slug, WHERE result = 'failed' AND 
                runs.id=" + str(run_id) + "")

                for slug, reason in cur.fetchall():

Upvotes: 0

Views: 88

Answers (1)

Gsk
Gsk

Reputation: 2945

In python code structure indentation is foundamental.

In your code, the problem is that the else statement has 0 indents (0 tabs OR 0 spaces) while the following line (run_id = id[0]) has 2 indents (2 tabs OR 8 spaces).

Dedenting by 1 this line should solve the problem (remove 1 tab or 4 spaces). You will face the same problem with the following line (runid_list.append(str(run_id))).

Anyway, I'd suggest to have a deep look on how indentation works in Python

Upvotes: 1

Related Questions