Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Machine Learning by (19k points)

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"])

1 Answer

0 votes
by (33.1k points)

Let's say 'time1' is the key of a dictionary, eg, feb2012. So you're trying to index the string, but you can only this with integers. 

For example:

for info in courses[time1][course]:

when you iterate through each dictionary, you must add another nest.

Hope this answer helps you!

If you wish to learn more about Machine Learning, visit the Machine Learning tutorial and Machine Learning Course by Intellipaat.

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...