This is a really basic question, but what is wrong with this code?
for row in rows:
if row["Type"] = 'DEADLINE':
print (row["Title"])
I get the error TabError: inconsistent use of tabs and spaces in indentation pointing to the colon at the end of the if.
Sorry if this is too newbie for SO, but I cant determine if its an issue with going from 2.x python to 3.x or if it’s just syntax I have yet to learn.
Thanks
EDIT: Problem solved. I didn’t realize my text editor had it’s ‘turn tabs into spaces’ feature turned off. So yes, it was a mix of tabs and spaces. I assumed the message meant I had an inconsistant use of whitespace in general, like there were too many spaces or something.
And yes, i realize the single = is a syntactic error, it was something I was trying to remove the TabError, but is obviously wrong.
You are probably mixing tabs and spaces for your indentation, just like the error message says.
Some editors have the annoying habit of replacing 8 spaces by a tab automatically, so your code might actually look like this:
where
->represents a tab character.Tell your editor to make tabs visible, and not to replace spaces again.
Alternatively, consistently indent using one tab per indent level.