我从控制台运行一些python代码(粘贴在其中),得到了一个意外的结果。代码如下:
parentfound = False
structfound = False
instruct = False
wordlist = []
fileHandle = open('cont.h')
for line in fileHandle:
if line is "":
print "skipping blank line"
continue
if "}" in line:
instruct = False
index = line.index("}")
wordlist.append(word)
pass
try:
print wordlist
except Exception as e:
print str(e)
在for循环之后,我想打印wordlist
。无论我做什么,我都不能包含for循环之外的任何内容。以下是我收到的错误:
不管是我手工把代码输入终端还是粘贴进去,都会发生这种情况。如果您能提供任何帮助,我将不胜感激。谢谢您!在
REPL中的
...
提示意味着它仍然没有完成上一个块。您需要在空行上按Enter以首先终止它。在相关问题 更多 >
编程相关推荐