[英]I am having a syntax error executing some python code [on hold]
So the problem is that I am having a sintax error in the "if" line of code.所以问题是我在“if”代码行中有一个 sintax 错误。 I am pretty new to python, so I am not understanding what's happening here.
我对 python 很陌生,所以我不明白这里发生了什么。
for d in dataset: #Percorre todo o dataset
countTotal = countTotal + 1 #Contar todos os tuplos por atributo
#Caso os valores do ciclo sejam iguais aos valores do d
if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx
count = count + 1
thisdict[(valA,valC)] = count
valClass_idx = valClass_idx + 1
You forgot to add ":" in this statement您忘记在此语句中添加“:”
if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx
It should be:它应该是:
if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx:
So, it was missing a ":" after the if statement: )所以,它在 if 语句之后缺少一个“:”:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.