Python缩进语法错误if/els

2024-04-24 05:46:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我写的打印程序出错了。你知道吗

from variables import *    
li = []
for i in range(len(word)):
    if i in graph:
        for j in graph[i]:
            if j in graph[i]:
                li.append(len(graph[i][j])
            else: # line 23
                li.append(0)
    else:
        for j in range(len(word)):
            li.append(0)
    print li
    del li[:]

错误是

File "eval.py", line 23
else:
   ^
SyntaxError: invalid syntax

我哪里出错了?你知道吗


Tags: infromimport程序forlenifline