pycharm convert tabs to spaces automatically

后端 未结 7 1233
一整个雨季
一整个雨季 2020-12-04 08:32

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

7条回答
  •  伪装坚强ぢ
    2020-12-04 09:28

    PyCharm 2019.1

    If you want to change the general settings:

    Open preferences, in macOS ; or in Windows/Linux Ctrl + Alt + S.

    Go to Editor -> Code Style -> Python, and if you want to follow PEP-8, choose Tab size: 4, Indent: 4, and Continuation indent: 8 as shown below:

    Apply the changes, and click on OK.

    If you want to apply the changes just to the current file

    Option 1: You can choose in the navigation bar: Edit -> Convert Indent -> To Spaces. (see image below)

    Option 2: You can execute "To Spaces" action by running the Find Action shortcut: A on macOS or ctrlA on Windows/Linux. Then type "To Spaces", and run the action as shown in the image below.

提交回复
热议问题