Python error "TypeError: string indices must be integers, not str"

0 votes

I'm getting the following python error:

 File "em_sep.py", line 13, in <module>
    if ema_1["confidence_score"] == "50":
TypeError: string indices must be integers, not str

Line 13 of the the code:

 email_s.append(email_1["email_address"])
Jul 5 in Python by Dipti
46 views

1 answer to this question.

0 votes

Hey @Dipti

 email_s.append(email_1["email_address"])

This is the list on which the iterator runs on and you tried changing it during the iteration. Use another list for appending. That shouldn't come in the way of iterating. 

answered Jul 5 by Jinu

Related Questions In Python

0 votes
3 answers
0 votes
2 answers
0 votes
1 answer

Python error "TypeError: Can't convert 'int' object to str implicitly"

Hey Yamini, you cannot concatenate a string ...READ MORE

answered May 31 in Python by Gargi
67 views
0 votes
0 answers

i am normalizing the data set iris in python and get the error ::TypeError: 'numpy.float64' object is not callable

for i in cnames:     print(i)     df_csv[i] = (df_csv[i] - ...READ MORE

5 days ago in Python by anonymous
10 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 128 views
+4 votes
6 answers
0 votes
1 answer
0 votes
1 answer

Python pygame error : Failed loading libpng.dylib: dlopen(libpng.dylib, 2): image not found

Try installing libpng You can do it with ...READ MORE

answered May 31 in Python by SDeb
• 12,360 points
21 views