如何解决缩进错误?

时间:2017-10-25 16:00:05

标签: python-3.x

我尝试将数据加载到机器学习模型中进行培训。这是我的功能:

  def load_train_data(nb_data, validation_split):

        x_train=np.empty([nb_data,nb_samples], dtype='float32')
        y_train=np.empty([nb_data], dtype='uint8')

        py_train_all=np.loadtxt('Labels_File.txt', dtype='uint8')

        cmpt=0
        if nb_traces_train > nb_traces_train_all:
            print('Errors');
            sys.exit(1)
        for lines in open('/Files.list','r'):
            bin_file='directory/'+lines.rstrip()+'.bin'
            if cmpt < nb_traces_train:
                x_train[cmpt]=np.fromfile(bin_file, dtype='float32')
                y_train[cmpt]=y_train_all[cmpt]
                if cmpt%10000==0:
                    print ("Load %s in <TRAIN>" % cmpt)
                    cmpt=cmpt+1
                else:
                    print('ERROR')
            else:
                print('ERROR')
        return (x_train,y_train) #,(x_val, y_val)

这就是我遇到的问题:

    if cmpt < nb_traces_train:
                             ^
TabError: inconsistent use of tabs and spaces in indentation

我使用notepad ++作为编辑器,这不是我第一次使用python3,但尝试修改我的列表,但我找不到问题所在, 如果你能帮助我,我将非常感激。

0 个答案:

没有答案