Sublime Text 2 >IndentationError< [duplicate]

2019-09-09 22:40发布

问题:

This question already has an answer here:

  • How to fix/convert space indentation in Sublime Text? 9 answers

I have a problem with sublime text 2. When I write some python scripts correctly at sublime text I always face on with this problem "IndentationError: unexpected indent" after a while I found, the problem is causing by sublime text. I tried other editors and corrected but sublime text didnt work correctly.

The main problem is, sublime text is adding extra tab to my line and that affects my script works. I couldnt find the reason. hope somebody help me. Thanks a lot.

回答1:

Go to Packages/User/Preferences.sublime-settings

Change it to this:

{
    "tab_size": 4,
    "translate_tabs_to_spaces": true
}