Why TypeError: string indices must be integers

You are iterating a dict here:

for target in targets:

so target will be the key, not a dict item.

1 Like