'IndentationError: unindent does not match any outer indentation level', when indent is completly correct
'IndentationError: unindent does not match any outer indentation level', when indent is completly correct
我不知道这是一个错误,还是我的编辑器错误,但在特定行,它总是抛出一个 'IndentationError: unindent ...'
我的代码是:
def tokType(token):
if type(token) is str:
if ":" in token:
out = ""
for c in token:
if c == ":":
break
out += c
return out
else:
return None
elif type(token) is list:
for i, t in enumerate(token):
if i != 0 and tokType(t) != tokType(token[i-1]):
return "multi"
return tokType(token[0])
else:
raise TypeError("Unsupported type {0}, expecting List or String!".format(type(token)))
为什么我会收到此错误?
这是编辑器的错误。它开始写制表符而不是空格。我刚刚找到 - 用空格替换了选项卡并检查了我的设置。
我不知道这是一个错误,还是我的编辑器错误,但在特定行,它总是抛出一个 'IndentationError: unindent ...'
我的代码是:
def tokType(token):
if type(token) is str:
if ":" in token:
out = ""
for c in token:
if c == ":":
break
out += c
return out
else:
return None
elif type(token) is list:
for i, t in enumerate(token):
if i != 0 and tokType(t) != tokType(token[i-1]):
return "multi"
return tokType(token[0])
else:
raise TypeError("Unsupported type {0}, expecting List or String!".format(type(token)))
为什么我会收到此错误?
这是编辑器的错误。它开始写制表符而不是空格。我刚刚找到 - 用空格替换了选项卡并检查了我的设置。