Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spyder Python indentation

Tags:

python

spyder

I am using spyder IDE for python coding. I copied the code from some source,it works fine. But when I make edits in it indentation error occurs. There is always some mistake in the alignment of my edit and the other part of code. Code is quite large I can't re indent it.

like image 904
Ajay Sunarthi Avatar asked Nov 06 '14 13:11

Ajay Sunarthi


People also ask

How do you indent in Python Spyder?

Select your code and press Tab for indent and Shift + Tab to un-indent. Edit section also contains some other tools for editing your code.

How do I fix indentations in Python?

Go to your code editor settings and enable the option that seeks to display tabs and whitespaces. With this feature enabled, you will see single small dots, where each dot represents a tab/white space. If you notice a drop is missing where it shouldn't be, then that line probably has an indentation error.

How do I remove a Spyder indentation error?

In Spyder v3. 0.0, go to Source --> Fix Indentation. That worked for me. Save this answer.

How do you fix inconsistent tabs and spaces in indentation in Spyder?

To view where Spyder has added the wrong formatting, go to Preferences > Editor and select; "show blank spaces" and "show indent guides". Delete the blank spaces and add indents. Job done.


1 Answers

In Spyder v3.0.0, go to Source --> Fix Indentation. That worked for me.

like image 146
cpc333 Avatar answered Sep 27 '22 21:09

cpc333