小编Jac*_*ang的帖子

Pydantic AttributeError:''对象没有属性'__fields_set__'

from pydantic import BaseModel

class A(BaseModel):
    date = ''

class B(A):
    person: float

    def __init__(self):
        self.person = 0
    
B()
Run Code Online (Sandbox Code Playgroud)

尝试启动类 B 但引发错误 AttributeError: 'B' object has no attribute ' fields_set ',为什么呢?

python inheritance class pydantic

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

标签 统计

class ×1

inheritance ×1

pydantic ×1

python ×1