user7849697
user7849697

Reputation: 597

How to fix a TabError

I have no idea why it keeps saying

TabError: inconsistent use of tabs and spaces in indentation

At the line

counter = 0

If I remove 'counter = 0', it works.

if counter < 3:
    counter = counter + 1
elif counter == 3:
    send_mail()
    counter = 0

Seriously I don't know what is wrong lol!

Upvotes: 0

Views: 859

Answers (1)

Phydeaux
Phydeaux

Reputation: 2855

You must use either all spaces or all tabs for your indentation, as the error message says.

Tabs and spaces, or using tabs at all for indentation, is considered bad practice in Python.

You would probably benefit from a good text editor or IDE that will show the difference between tabs and spaces, and automatically insert spaces for you while you code.

Upvotes: 1

Related Questions