“inconsistent use of tabs and spaces in indentation”

后端 未结 28 2642
北恋
北恋 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:33

    Don't use tabs.

    1. Set your editor to use 4 spaces for indentation.
    2. Make a search and replace to replace all tabs with 4 spaces.
    3. Make sure your editor is set to display tabs as 8 spaces.

    Note: The reason for 8 spaces for tabs is so that you immediately notice when tabs have been inserted unintentionally - such as when copying and pasting from example code that uses tabs instead of spaces.

提交回复
热议问题