TypeError: ‘builtin_function_or_method’ object has no attribute ‘__getitem__’

The problem is that index is a method and needs to be called with () not []. To use Kasra’s example:

>>> s="aeer"
>>> s.index('a')
0

Leave a Comment