在下面我將得到錯誤混亂取消縮進錯誤
IndentationError: unindent does not match any outer indentation level (hisrel_split.py, line 25)
這是elif
線。我檢查了我的所有縮進,甚至重新輸入了大部分縮進。要麼我在這裏失去了一些明顯的東西,或者有一些我不知道的細微規則。任何想法
from numpy import *
from pylab import *
import sys
ifp = open(sys.argv[1],"r").readlines()
data_1 = []
data_2 = []
data = []
last = int(ifp[-1].split()[0])
set_1 = range(int(round(last)/2))
set_2 = range(int(round(last)/2),(last+1))
for i in ifp:
d = i.split()
try:
data.append(eval(d[2]))
except:
continue
if eval(d[0]) in set_1 and eval(d[1]) in set_1:
try:
data_1.append(eval(d[2]))
except:
continue
elif eval(d[0]) in set_2 and eval(d[1]) in set_2:
print "yes"
您是否檢查過您是否在縮進中混合了製表符和空格? –
你在混合標籤和空格。你可以告訴你是否進入編輯窗口;從左邊距開始,多次按右箭頭。有時它通過空間向前移動空間;有時它會向前跳。試試這一行:'data.append(eval(d [2]))'。 – senderle
如果您使用IDLE,請嘗試關閉並重新打開它。我看到一個奇怪的錯誤,IDLE變得困惑,並且沒有很好的理由拋出這個錯誤。 – 8bitwide