python踩雷记录(1)SyntaxError: unindent does not match any outer indentation level

所写代码如下:

>>> sites = {1, 2, 3, 1, 4, 2}
>>> sites # 去重输出
{1, 2, 3, 4}
>>> if 1 in sites :
	print('in')
    else :
	    
SyntaxError: unindent does not match any outer indentation level

经过排查,错误原因是:
if前面是没有空格的, else前面留了空格。导致EDLE无法识别,出现语法错误。
更正:

>>> if 1 in sites :
	print('in')
else :
	print('out')

这样就没有报错啦~

猜你喜欢

转载自blog.csdn.net/tuzi007a/article/details/107032193
今日推荐