[英]I am having a syntax error executing some python code [on hold]
所以問題是我在“if”代碼行中有一個 sintax 錯誤。 我對 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
您忘記在此語句中添加“:”
if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx
它應該是:
if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx:
所以,它在 if 語句之后缺少一個“:”:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.