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, 2019 in Python by Dipti
22,690 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. 

Hope this will help!

If you need to know more about Python, join Python certification course online today.

Thanks!

answered Jul 5, 2019 by Jinu

Related Questions In Python

0 votes
3 answers
+1 vote
1 answer

Can anyone help me with this error: TypeError: list indices must be integers or slices, not str

Hi, @Varshap  It’s a TypeError, which tells us ...READ MORE

answered Nov 5, 2020 in Python by anonymous
• 65,910 points
2,037 views
0 votes
1 answer

TypeError: list indices must be integers or slices, not str

Hi@akhtar, As we know that the index of ...READ MORE

answered Oct 15, 2020 in Python by MD
• 95,440 points
13,411 views
0 votes
1 answer

i am getting this error "TypeError: tuple indices must be integers or slices, not Database"

Hi, @Shabaj, Regarding your query, I hope this ...READ MORE

answered Dec 10, 2020 in Python by Gitika
• 65,910 points
887 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,056 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,476 views
0 votes
1 answer

Python error "TypeError: Cannot compare types 'ndarray(dtype=int64)' and 'str'"

Hey @Ashish, change the emotion_map to the ...READ MORE

answered May 30, 2019 in Python by Mir
7,680 views
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, 2019 in Python by SDeb
• 13,300 points
1,438 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP