Skip to main content
 首页 » 编程设计

python之Unindent 不匹配任何外部缩进级别

2025年05月04日10txw1958

<分区>

Possible Duplicate:
IndentationError: unindent does not match any outer indentation level

我有以下 python 代码。

import sys 
 
ins = open( sys.argv[1], "r" ) 
array = [] 
for line in ins: 
    s = line.split() 
    array.append( s[0] ) # <-- Error here  
print array 
 
ins.close() 

python解释器提示

  File "sort.py", line 7 
    array.append( s[0] ) 
                       ^ 
IndentationError: unindent does not match any outer indentation level 

为什么会这样?以及如何纠正这个错误?