如何解决Notepad++中缩进不一致的问题

How to solve inconsistent indentation in Notepad++

我正在学习 python 的基础知识,但遇到了缩进问题。 当我尝试 运行 GitBash 上的代码时,出现错误:

$ python organize_photos.py


File "organize_photos.py", line 7
    if place not in places:
                          ^
TabError: inconsistent use of tabs and spaces in indentation

所以我在 Notepad++ 上检查了我的代码,它在第 7 行给我一些问题,

但对我来说缩进看起来不错,可能是什么问题?

Python 不喜欢制表符和空格的混合。我个人更喜欢使用空格,因为它们在任何系统上都呈现相同的效果。
我看到您正在使用 Notepad++,您可以前往 Settings > Preferences > Language > Tab Settings 并将所有制表符转换为空格。