IndentationError: unindent does not match any outer indentation level

旧城等待, 2022-06-04 06:53 226阅读 0赞

python 2.7代码运行出现IndentationError: unindent does not match any outer indentation level

示例代码:

def cmp_ignore_case(s1, s2):

  1. u1 = s1.upper()
  2. u2 = s2.upper()
  3. if u1 < u2:
  4. return -1
  5. if u1 > u2:
  6. return 1
  7. return 0

print sorted([‘bob’, ‘about’, ‘Zoo’, ‘Credit’], cmp_ignore_case)

由于u1变量和u2变量代码缩进没有对齐

发表评论

表情:
评论列表 (有 0 条评论,226人围观)

还没有评论,来说两句吧...

相关阅读