Advertisement

使用notepda++查看并调整Python代码缩进(IndentationError: unexpected indent python)

阅读量:

今日在进行线上api部署过程中,测试阶段python程序突然出现错误提示:IndentationError: unexpected indent python.**** 通过网络搜索后得知,该异常主要由代码缩进问题引发。

接下来将简要说明如何借助notepad++工具来检测并调整py文件中的缩进设置。

检测缩进方式 :通过菜单栏选择View → Show Symbol → Show White Space and TAB

调整缩进方式 :在编辑选项中点击Edit → Blank Operations → TAB to Space

1)检测缩进

检测到所使用的py文件中确实存在缩进方面的错误

2)调整缩进设置

![](https://ad.itadn.com/c/weblog/blog-img/images/2025-05-31/FUAWLzksMY1SXivjO

全部评论 (0)

还没有任何评论哟~