当我运行此代码时:
def printPredictions(matches):
pPredictionTable = PrettyTable()
pPredictionTable.field_names = ["Player 1", "Player 2", "Difference", "Winner"]
for match in matches:
p1 = match['teamA']
p2 = match['teamB']
if match['aBeatb'] == True:
pPredictionTable.add_row([match['teamA'], match['teamB'], match['difference'], p1])
else:
pPredictionTable.add_row([match['teamA'], match['teamB'], match['difference'], p2])
print(pPredictionTable)
printPredictions(pmatches)
我收到此错误:
Traceback (most recent call last):
File "C:\Users\ericr_000\Desktop\PyDev\NPA-2-Rating-System\Rankings.py", line 645, in <module>
printPredictions()
TypeError: 'str' object is not callable
我将pmatches作为单独的词典,而且我没有编码技巧来解决这个问题。 (第145行是printPredictions(匹配)