当我试图运行这段代码时,它给了我一条错误消息line21 UnexpectedIndent。我该怎么办?谢谢。你知道吗
for filepath in matches:
with open (filepath,'rt') as mytext:
mytext=mytext.read()
print re.findall(r'NSF\s+Org\s+\:\s+(\w+)',mytext) #This line just aims to diagnose the problem.
matchOrg=re.findall(r'NSF\s+Org\s+\:\s+(\w+)',mytext)[0]
capturedorgs.append(matchOrg)
当我摆脱print re.findall(r'NSF\s+Org\s+\:\s+(\w+)',mytext)
时,错误消息是MatchOrg... list out of range
。你知道吗
去开会。将在4p后检查所有回复
行
mytext=...
用制表符缩进,其余行用空格缩进。使用制表符或空格,但不要混合使用。鼓励使用空格而不是制表符。你知道吗在文本编辑器中,使用该选项可显示所有字符。确保缩进用空格或制表符表示,而不是两者的混合。你知道吗
当您从其他源复制代码片段时,源代码和其他源代码的缩进可能不同,从而导致python解释器抛出意外的缩进错误,如下所示
相关问题 更多 >
编程相关推荐