Python Forum

Full Version: Error in Int object is not subscript-able. How to debug this ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
for j in range(len(index)):
        if index[j] < i:
            line_id = humid[index[j]][i] - 1
        else:
            line_id = humid[i][index[j]] - 1
                                              ## index =[2] len(index) =1
                                              ## humid= [[0, 1, 0, 0], [0, 0, 2, 0], [0, 0, 0, 3], [0, 0, 0, 0]] 

-----------------------------------------------------------------------------------
     25     for j in range(len(index)):
     26         if index[j] < i:
---> 27             humid= humid[2][i] - 1
     28         else:
     29             humid= humid[i][index[j]] - 1

TypeError: 'int' object is not subscriptable
please show code and (complete and unmodified) error message in bbcode tags.