這是錯誤:maximum recursion depth exceeded while calling a Python object我正在使用beautifulsoup解析從中接收到的網頁 HTML,requests然后將解析后的數據存儲到Product類中。該函數通過從 調用一個線程來運行ThreadPoolExecutor()。運行功能:executor = ThreadPoolExecutor()t2 = executor.submit(ScrapePageFull, PageHtml)product = t2.result()ScrapePageFull功能:def ScrapePageFull(data):soup = BeautifulSoup(data)product = Product()# Priceprice = soup.find(DIV, {ID: DATA_METRICS})[ASIN_PRICE]product.price = float(price)# ASINASIN = soup.find(DIV, {ID: DATA_METRICS})[ASIN_ASIN]product.asin = ASIN# Titletitle = soup.find(META, {NAME: TITLE})[CONTENT]product.title = title# Price Stringprice_string = soup.find(SPAN, {ID: PRICE_BLOCK}).textproduct.price_string = price_stringreturn product這是Product課程:class Product:def __init__(self): self.title = None self.price = None self.price_string = None self.asin = None pass# Getters@propertydef title(self): return self.title@propertydef price(self): return self.price@propertydef asin(self): return self.asin@propertydef price_string(self): return self.price_string# [email protected] title(self, title): self.title = [email protected] price(self, price): self.price = [email protected] asin(self, asin): self.asin = asin@price_string.setterdef price_string(self, price_string): self.price_string = price_string感謝您的幫助,謝謝。
Flask 應用程序超出 Python 最大遞歸深度
ibeautiful
2022-11-29 14:52:40