from db import MongoDao from data.bean.ProductInfo import ProductInfo class BrandInfo: def __init__(self, brand_name): self._dao = MongoDao("vbrand-ec") self.brand_name = brand_name self.product_list = [ProductInfo(record) for record in self._dao.get_records_by_query({"brandName": brand_name})] if __name__ == "__main__": brand_info = BrandInfo("李宁") for i in brand_info.product_list: print(i.image)