下面的代碼以第一個elif語句中的invlid語法顯示。我檢查並重新檢查了我的代碼幾次,但無法弄清楚如何解決錯誤。Python elif中的語法無效
fileHandle = open ('gra1.txt')
count=0
count1=0
fileList = fileHandle.readlines()
for fileLine in fileList:
line=fileLine.split()
if line[0] == '0':
print "graph G%d {\n", (count)
count +=1
elif line[0] == '1':
print "} \n"
elif line[0]=='':
continue
else:
count1 += 1
if count1==1: a=line[0]
elif count1==2: relation=line[0]
elif count1==3: b=line[0]
else:
print a, relation, b
count1=0
fileHandle.close()
看看__indentation__。 – devnull
看到這個http://www.secnetix.de/~olli/Python/block_indentation.hawk –