Python: TypeError: 'str' object is not callable Rating System -
when run code:
def printpredictions(matches): ppredictiontable = prettytable() ppredictiontable.field_names = ["player 1", "player 2", "difference", "winner"] 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)
i error:
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 not callable
i have pmatches separate dictionary, , don't have coding skills fix issue. (line 145 printpredictions(pmatches)
if you're getting 'str' object not callable
when try call printpredictions
, means time program reaches line 645, name printpredictions
reassigned string. somewhere in code have like
printpredictions = somestringvaluegoeshere
you should choose different name variable, or delete line entirely.
foobar = somestringvaluegoeshere
Comments
Post a Comment