Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing indentation settings in the Spyder editor for Python

Tags:

I am using the Spyder editor for Python. I need to change the indentation setting (e.g., let "tab" mean "4 spaces").

How do I accomplish this?

like image 928
jesperk.eth Avatar asked Mar 23 '16 20:03

jesperk.eth


People also ask

How do I fix the indentation in Python Spyder?

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

How do you align codes on 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 indent a Python file?

Use the reindent.py script that you find in the Tools/scripts/ directory of your Python installation: Change Python (. py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files.


1 Answers

Spyder v. 4.0 or higher:

Tools >>> Preferences >>> Editor >>> Source code >>> Indentation characters

Other versions:

Tools >>> Preferences >>> Editor >>> Advanced settings >>> Indentation characters

like image 143
Vadim Shkaberda Avatar answered Oct 12 '22 08:10

Vadim Shkaberda