TabError:缩进Jupyter Notebook中的制表符和空格使用不一致

时间:2018-12-06 01:32:01

标签: jupyter-notebook

每当我尝试在jupyter笔记本中运行以下代码时:

#There is a class before this code 
def __init__(self):
        super(MainWindow, self).__init__()
        loadUi('chinesestock (1).ui', self)
        self.averagestockpricecalculate.clicked.connect(self.average)
        self.pushButton_2.clicked.connect(self.calcCoCo)
        stock = stocks()
        self.graphdatagraphdata.clicked.connect(self.graphdata)
        self.stocks = stock.stocks
        self.pushButton_3.clicked.connect(self.grapha)
        # Line 47 is a line ahead, (the line that has the error)
        self.pushButton_4.clicked.connect(self.graphb)

我收到此错误:

 File "<ipython-input-1-f169580a30e0>", line 50
bstock=self.averagestockstock1.currentText()
TabError: inconsistent use of tabs and spaces in indentation

我已经检查了我的空间。我也尝试将代码粘贴到另一个ipynb文件中,但是在不同的行上遇到相同的错误。

1 个答案:

答案 0 :(得分:0)

我只是复制了代码,并将其粘贴为python文件的高级文本。现在可以了,谢谢!