“inconsistent use of tabs and spaces in indentation”

后端 未结 28 2787
北恋
北恋 2020-11-22 00:56

I\'m trying to create an application in Python 3.2 and I use tabs all the time for indentation, but even the editor changes some of them into spaces and then print out \"inc

28条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 01:23

    Solving this using Vim editor

    1. Open terminal (Ctrl + Alt + T).
    2. Go to the directory where the file is located (cd ). Ex: cd /home/vineeshvs/work.
    3. Open the file in Vim (vim ). Ex: vim myfile.txt .
    4. [Optional step] Enable search keyword highlighting in Vim (ESC :set hlsearch)
    5. Go to the line where you have this problem (ESC :). Ex: :53 in Vim editor after pressing ESC button once.
    6. Replace tabs using the required number of spaces in Vim (:.,$s/\t//gc). Ex: Tab will be replaced with four spaces using the following command: :.,$s/\t/ /gc after pressing ESC button once). This process is interactive. You may give y to replace the tab with spaces and n to skip a particular replacement. Press ESC when you are done with the required replacements.

提交回复
热议问题