我正在尝试使解析器使用beautifulSoup和多处理.我有一个错误:
RecursionError:超出最大递归深度
我的代码是:
import bs4, requests, time
from multiprocessing.pool import Pool
html = requests.get('https://www.avito.ru/moskva/avtomobili/bmw/x6?sgtd=5&radius=0')
soup = bs4.BeautifulSoup(html.text, "html.parser")
divList = soup.find_all("div", {'class': 'item_table-header'})
def new_check():
with Pool() as pool:
pool.map(get_info, divList)
def get_info(each):
pass
if __name__ == '__main__':
new_check()
Run Code Online (Sandbox Code Playgroud)
为什么我会收到此错误以及如何解决?
更新: 错误的所有文本是
Traceback (most recent call last):
File "C:/Users/eugen/PycharmProjects/avito/main.py", line 73, in <module> new_check()
File "C:/Users/eugen/PycharmProjects/avito/main.py", line 67, in new_check
pool.map(get_info, divList)
File "C:\Users\eugen\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 266, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "C:\Users\eugen\AppData\Local\Programs\Python\Python36\lib\multiprocessing\pool.py", line 644, in get
raise …Run Code Online (Sandbox Code Playgroud) 此代码正在更改类中所有 CharField 的大小。如何更改一个 CharField 的大小?
formfield_overrides = {
models.CharField: {'widget': TextInput(attrs={'size': '20'})},
}
Run Code Online (Sandbox Code Playgroud)