Sandy
0
Q:

TypeError: 'method' object is not subscriptable

You need to use parentheses: myList.insert([1, 2, 3]). When you leave out the parentheses, python thinks you are trying to access myList.insert at position 1, 2, 3, because that's what brackets are used for when they are right next to a variable.
1
The “TypeError: 'method' object is not subscriptable” error is raised when you use square brackets [] to call a method inside a class. To solve this error, make sure that you only call methods of a class using curly brackets () after the name of the method you want to call.
0

New to Communities?

Join the community