python选项卡的使用不一致

2024-05-18 23:40:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我遇到以下错误:如何修复它

文件“/Users/rjeudy/PycharmProjects/virtualenv/virtualenv/src/products/forms.py”,第35行 def clean_标题(自身、*args、**kwargs): ^ TabError:缩进中制表符和空格的使用不一致

        def clean_title(self, *args, **kwargs):
            title = self.cleaned_data.get("title")
            if "CFE" in title:
                return title

Tags: 文件selfsrccleanvirtualenvtitledef错误
2条回答

欢迎来到SO

这是你的缩进。如果您正在使用PyCharm,您可以重新格式化代码和/或自动缩进行

在任务栏中: 代码->;自动缩进行

https://www.jetbrains.com/help/pycharm/reformat-and-rearrange-code.html

问题是您使用的制表符和空格不一致

https://medium.com/@peey/what-is-the-inconsistent-use-of-tabs-and-spaces-in-indentation-error-and-why-is-it-caused-f3bbb8b2568b

如果使用vim作为文本编辑器,可以使用“:retab”修复此问题

相关问题 更多 >

    热门问题