开发者

Python Syntax Errors after print

开发者 https://www.devze.com 2023-03-21 23:45 出处:网络
Everything was working fine in this program I\'ve been writing, and then out of nowhere I started getting all sorts of weird errors. For example:

Everything was working fine in this program I've been writing, and then out of nowhere I started getting all sorts of weird errors. For example:

    print Bounds[atomCounter][i][2]
    elif Bounds[atomCounter][i][2] == 'S':

Gives the error:

elif Bounds[atomCounter][i][2] == 'S':
   ^
SyntaxError: invalid syntax

It didn't give this error like ten minutes ago, and it doesn't unless the print statement is there. If the print statement isn't there, I get an index out of bounds error - but that shouldn't but the case, because the print sta开发者_如何转开发tement works (just causes an error in the code after it)... anybody know what's wrong?


I don't know why you're using elif, but you can only do that after an if or another elif block. So of course that wouldn't work.

Since it looks like you might have an if block before what you've written, try indenting the print line and see if that works.

0

精彩评论

暂无评论...
验证码 换一张
取 消