python == 语法错误
我通过风车测试收到以下代码的语法错误。看起来它不喜欢 == 对我做错了什么有任何想法
counter = 0
while True:
try:
# some code goes here
except:
counter += 1
# some code goes here
if counter == 3
counter = 0
i am getting a syntax error with the following code via a windmill test. it looks like it does not like the == any thoughts on what I am doing wrong
counter = 0
while True:
try:
# some code goes here
except:
counter += 1
# some code goes here
if counter == 3
counter = 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
if 语句后需要一个冒号。
编辑:修复代码的格式。
我还看到您正在使用 C 风格的注释,Python 不支持。 Python 中的所有注释都以
#
开头。此外,Python 通过缩进来分隔块。确保块的缩进一致。
You need a colon after your if-statement.
edit: fix the formatting of your code.
I also see you're using C-style comments, which Python doesn't support. All comments in Python start with
#
.Also, Python dellimits blocks by their indentation. Make sure you indent blocks consistently.
您有语法错误。 if 语句后需要一个冒号,并且缩进可能是错误的(通过粘贴的方式不容易辨别)。另外,注释前面有 #,而不是 //
正确地改写它:
You have a syntax error. You need a colon after the if statement, and the indentation may be wrong (not easy to tell with the way you've pasted it). Also comments are preceded by a #, not //
To rephrase it correctly: