Python的原子编辑器缩进错误 [英] atom editor indentation error with Python

查看:74
本文介绍了Python的原子编辑器缩进错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是原子的新手,所以我使用原子打开了我现有的代码并修改了几行,然后当我尝试使用python运行代码时,出现以下错误:

I am new to atom, so I opened my existing code using atom and modified few lines, then when I tried running the code with python, I get the following error:

IndentationError: unindent does not match any outer indentation level

我意识到Atom编辑器的缩进方式与我的代码不同.请参阅下面的图片,其中显示了不同的压痕样式.第1300行是旧的缩进,第1301行是Atom创建的

I realized that Atom editor does indent my code differently to what I had. refer to the attached picture below showing the different indentation styles. line 1300 is the old indentation and 1301 is the one created by Atom

如何在不修改我的1000+行代码的情况下解决此问题,以使原子使用相同的缩进样式.

How can I fix this without modifying my 1000+ line code and so that atom uses the same style of indentation.

推荐答案

您在代码中混用了制表符和空格.您应始终使用空格.

You have mixed tabs and spaces in your code. You should use spaces, always.

您可以使用此插件来快速修复代码,请为每个缩进级别仅使用空格和4个空格.

You can use this plugin to quickly fix your code, and please, use only spaces and 4 spaces for each level of indentation.

这篇关于Python的原子编辑器缩进错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆