Python error: typeerror: ‘Int’ object is not subscribable

Check the error line, the error is generally in the integer subscript:
Such as:

a = 4
c=a[2]

Error: line 2, in < module>
c = a [2]
TypeError: ‘int’ object is not subscriptable
Take the more complicated one: two dimensions
 

a = [1,2,3,4]
c=a[2][2]

It’s a one-dimensional array, but it takes an array index, and then it adds a index, same problem.

Read More: