制表符错误:缩进中制表符和空格的使用不一致


class SimpleBatch(object):
    def __init__(self, data_names, data, label_names, label):
        self.data =(data) 
          self.label= label
          self.data_names = data_names
          self.label_names = label_names
    @property
    def provide_data(self):
        return [(n,x.shape) for n,x in zip(self.data_names, self.data)]
    @property
    def provide_label(self):
        return [(n,x.shape) for n,x in zip(self.label_names, self.label)]

init 方法中较低的三行在方法的第一行并不相同。在整个代码中,制表符间距需要保持一致。

您不小心在"self.data =(data("之后添加了制表符

class SimpleBatch(object):
    def __init__(self, data_names, data, label_names, label):
        self.data =(data) 
        self.label= label
        self.data_names = data_names
        self.label_names = label_names
    @property
    def provide_data(self):
        return [(n,x.shape) for n,x in zip(self.data_names, self.data)]
    @property
    def provide_label(self):
        return [(n,x.shape) for n,x in zip(self.label_names, self.label)]

相关内容

  • 没有找到相关文章