# 主播模型 class AnchorModel: def __init__(self, anchorId= "", country= ""): # 主播ID self.anchorId = anchorId # 主播国家 self.country = country # 字典转模型 @classmethod def dictToModel(cls, d): model = AnchorModel() model.anchorId = d.get('anchorId', "") model.country = d.get('country', "") return model