-1
def load_papers(ballots_file_name, FirstFile):
candidates = {}
voter = 1
with open(ballots_file_name, 'r') as j:
for paper in j:
paper = paper.split(',')
for i in range(0, len(paper)):
candidate_name = FirstFile
[i]v_dict = {"voter": "voter", "pref": "int(paper[i])"}
if candidate_name in candidates:
candidates[candidate_name].append(v_dict[i])
else:
candidates[candidate_name] = [v_dict[i]]
voter += 1
return {"num_voters": voter, "candidates": candidates}
エラーで変数を定義するための構文エラーを得続ける私が手:エラーメッセージが明確に述べて私は、リストのpython
[i]v_dict = {"voter": "voter", "pref": "int(paper[i])"}
^
SyntaxError: invalid syntax
あなたには不正な改行があります。 –