目前stackoverflow找到两种情况的解决办法: 1.TypeError: 'type' object is not subscriptable when indexing in to a dictionary I have multiple files that I need to load so I'm using a dict to shorten things. When I run I get a "TypeError: 'type' object is not subscrip…
用循环依次对list中的每个名字打印出 Hello, xxx! -------------------------------------------------------- L = ['Bart', 'Lisa', 'Adam']x = len(L) for i in range(x): print('Hello,', L[i]) -------------------------------------------------------- 此处,若直接使用 for i in x 时,…
TypeError: 'generator' object is not subscriptable 生成器对象不可以带下标 def get_row(self,row_no): if not isinstance(row_no,int): return None if self.sheet is not None: return self.sheet.rows[row_no-1] return None…
TypeError: 'int' object is not callable 这个错误的原因很简单 看下面的程序: def loss(a,b): return a-b loss = 0 loss = loss(5,2)+1 错误定位: loss = loss(5,2)+1TypeError: 'int' object is not callable 原因: 函数名loss 变量名loss 重合!!! 以此类推到其他类型的错误…