Python - Typeerror: String Indices Must Be Integers
For some reason this piece of script is returning the error: 'TypeError: string indices must be integers'; and I cannot see what's wrong. Am I being stupid and overlooking an obvio
Solution 1:
I think you want it this way: definition = terms[term]
Solution 2:
This line definition = term[terms]
is trying to get a character out of the string term
. You probably just typoed, and want
definition = terms[term]
^ here, reference the dict, not the string
Solution 3:
Solution 4:
You accidentally swapped the variables. Change this:
definition = term[terms]
To this:
definition = terms[term]
Post a Comment for "Python - Typeerror: String Indices Must Be Integers"