A
A
Alexander Shilov2019-01-17 15:58:29
Python
Alexander Shilov, 2019-01-17 15:58:29

How to avoid TabError in Python?

Good day, toasters, tell me, please, mb someone has already encountered such a problem. The problem is that I write Python code, save the file, close it. Then I open it again, start writing code, and it starts giving me a TabError error

TabError
5c407bbd685e8718487574.png

I tried many editors, but from time to time this occurs in all. What can be and how to solve?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2019-01-17
@deliro

1. Read the error first.
2. Put an editor that can show tabs and spaces with different characters
3. Make sure that you either have only tabs or only spaces. Better, of course, only spaces, because PEP8
4. Do not ask stupid questions, the answers to which are in Google for as many as 10 relevant pages

S
sudo rm -rf /, 2019-01-17
@MaxLevs

TabError says that indentations from both tabs and spaces are mixed up in the code.
Decide what style of indentation to use and bring the code to uniformity. (According to PEP8, 4 spaces are preferred).
Also make sure that the indentations are correct, as this is critical in Python.

D
Danil Polyansky, 2019-01-18
@danil_polyanskiy

TabError - Thrown if an indentation error occurs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question