尝试运行我的脚本时出现缩进不一致错误

时间:2018-11-30 18:26:24

标签: python

我不断得到:

File "app.py", line 59
df = pd.DataFrame(list(db.mycol.find({}))), inconsistent use of tabs and spaces in indentation

我不知道是什么原因引起的。我已经试图取消它的标签了。我正在使用崇高的文字。有什么建议吗?

def gen_wind_speed(interval):
    now = dt.datetime.now()
    sec = now.second
    minute = now.minute
    hour = now.hour

    total_time = (hour * 3600) + (minute * 60) + (sec)
    client = MongoClient(port=27017)

    db = client.one
    mycol = client['coll']

    df = pd.DataFrame(list(db.mycol.find({})))

1 个答案:

答案 0 :(得分:1)

正如错误所暗示的,并且我认为您理解,某个地方有一个inconsistent use of tabs and spaces。您所在的行并不总是意味着该行发生了错误。制表符/空格错误可能在其上方的任何位置。

如果您已经按照神圣的诫命将此函数中的所有间距都重做4个空格,那么我将在此函数定义上方查看。最坏的情况是,您必须使用搜索工具来找到标签。

相关问题