Fix Python – pycharm convert tabs to spaces automatically

Question

Asked By – Vaibhav Mishra

I am using pycharm IDE for python development it works perfectly fine for django code so suspected that converting tabs to spaces is default behaviour, however in python IDE is giving errors everywhere because it can’t convert tabs to spaces automatically is there a way to achieve this.

Now we will see solution for issue: pycharm convert tabs to spaces automatically


Answer

Change the code style to use spaces instead of tabs:

spaces

Then select a folder you want to convert in the Project View and use Code | Reformat Code.

This question is answered By – CrazyCoder

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0