Reputation: 63022
I have tabs and indents|indent
set to 2:
However the actual indentation is coming up as 3 - specifically inside the groupby
function - which I have unindented and re-indented several times to be sure the behavior were consistent[-ly incorrect]:
Note that I have also tried the Auto-indent
(Option-Command-I
) - it also indents stuff to 3 spaces instead of 2. Bit strange..
Any thoughts?
Upvotes: 2
Views: 2789
Reputation: 51
This is most annoying problem in pycharm. Here is simple answer to this :
Just follow the path :
GO to Edit->Convert Indents->To Spaces
This will actually insert space instead of tabular character in empty space when you default enter for next line.
Upvotes: 2
Reputation: 6735
The first thing you might want to check is to make sure you don't have Detect and use existing file indents for editing enabled in Settings/Preferences | Editor | Code Style
. If you do, when you auto-indent, it might apply the wrong settings.
You can try to fix incorrectly formatted code by using Option+Command+L
(Mac) / Control+Alt+L
(PC), which is the Reformat Code option. That should fix the code and then auto-indent should work correctly.
Upvotes: 8