Taberror Inconsistent Use Of Tabs And Spaces In Indentation
So i couldn t use tab directly.
Taberror inconsistent use of tabs and spaces in indentation. When indenting in python you must use either spaces or tabs. Spaces are the preferred indentation method. Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.
Tabs should be used solely to remain consistent with code that is already indented with tabs. Tabs should be used solely to remain consistent with code that is already indented with tabs. When the code is executed the taberror inconsistent use of tabs and spaces in indentation.
Inconsistent use of tabs and spaces in indentation error is raised when you try to indent code using both spaces and tabs. As to whether to use tabs or spaces please refer to pep8 the python coding style guide. Because you ve inconsistently used spaces and tabs in your indentation.
To fix this you have to ensure that the code has even indentation. Inconsistent use of tabs and spaces in indentation and i cannot seem to work out the problem. Seemingly on windows idle the tabs are 4 spaces wide whereas in gedit the tabs currently are 8 spaces wide.
One way to combat this error is to go to the settings of your text editor and enable the convert tabs to spaces feature which automatically replaces the tab character with n space characters n. To avoid in the future train yourself to use only the tab key or the space key to indent and consider setting your editor to automatically convert tabs to spaces. Spaces are the preferred indentation method.
You fix this error by sticking to either spaces or tabs in a program and replacing any tabs or spaces that do not use your preferred method of indentation. Inconsistent use of tabs and spaces in indentation error even when visually there is no inconsistent tabbing or indentation done. Inconsistent use of tabs and spaces in indentation error even when visually there is no inconsistent tabbing or indentation done.