Home>

def Func1 ():
for x in range (0, len (ProcessText1)):
Func2 (A [x], B [x])
pass
pass

TypeError:'method'object is not subscriptable.
What should I do?
A [x] and B [x] are lists. ProcessText1 is also a list.
In addition, the above error appears at Func2 (A [x], B [x]).

  • Answer # 1

    TypeError: The error'method'object is not subscriptable is an object that cannot access subscripts.
    Since it is'method&apos ;, it seems that [0] is specified for the method object itself in the class.

    For example, the following code will generate the same error.

    class MyClass:
        def my_function (self):
            pass
    A = MyClass (). My_function
    A [0]

    I can't say anything without looking at the other codes, but I think this error is in A [x], B [x].
    Isn't there a mistake in A (x), B (x), etc.?

    Other respondents may be able to answer more easily by pasting the full text of the error content or the full text of the source code, and reproducing the same error with the minimum code if it is severe. not.

Related articles