小编Uri*_*ria的帖子

如何处理IndentationError:unindent与任何外部缩进级别都不匹配

我到处搜索,我无法在任何地方找到答案,我的代码遇到了问题,我正在尝试用peewee做一个简单的清单.我所拥有的就是这个错误.

  File "inventario.py", line 38
if selection =='1':
                  ^
IndentationError: unindent does not match any outer indentation level
Run Code Online (Sandbox Code Playgroud)

我已经读过与空格混合的标签可以实现这一点,已经检查过,甚至使用SublimeText工具必须用空格替换制表符.

from peewee import *

db = SqliteDatabase('stockpy.db') #creates db

class Product(Model): #data to create product table
    id_prod = IntegerField()
    name = CharField()
    price = IntegerField()
    stock = IntegerField()

    class Meta:
        database = db #tells which db to use 

Product.create_table() #creates table

def newProd(id_prod, name, price, stock):
     Product.create(id_prod =  id_prod, name = name, price = price, stock = stock) #adds new product …
Run Code Online (Sandbox Code Playgroud)

python database peewee

1
推荐指数
1
解决办法
4975
查看次数

标签 统计

database ×1

peewee ×1

python ×1