python中的缩进错误 [英] Indentation errors in python

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

问题描述

我正在用记事本++做python编程,

I am doing python programming in notepad++ ,

正如许多帖子中所建议的,我下载了一个名为python indent"的工具并将其设置为启用.

so as suggested in many posts I have downloaded a tool called "python indent" and set it as enable.

即使在此之后,当我输入打印语句时,我仍然收到缩进错误,例如IndentationError: unindent does not match any external indentation level",是否还有其他工具可用于此目的?因为在 javascript 中,当我选择整个文件并转到 jshint 工具并选择缩进时,我只会得到正确缩进的文件.

Even after this , when I type in the print statement still I get the indentation errors such as "IndentationError: unindent does not match any outer indentation level" , any other tool is available for this purpose? Because in javascript ,when I select the entire file and go to jshint tool and select indentation, I just get the properly indented file .

我正在 python 中搜索工具,但无法获得.请问大家有什么建议吗?

I am searching for a tool in python , but not able to get it. Anybody has any suggestions please?

试试:

    print "hi"
    keys = mgt.get_keys(name)

插入打印语句后出现错误

I am getting the error after inserting print statement

推荐答案

听起来像是在块中混合了制表符和空格.使用其中之一,但不要同时使用.

Sounds like you have mixed tabs and spaces in your block. Use one or the other, but not both.

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

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