Я хочу извлечь только текст из исходного кода (html-коды, которые являются div id "col-green").Когда я хочу извлечь только текст в исходном коде, появляется предупреждение.
from bs4 import BeautifulSoup
import requests
page_link = 'http://drneclayazicioglu.meb.k12.tr/'
page_response = requests.get(page_link, timeout=5)
page_content = BeautifulSoup(page_response.content, "html.parser")
source_code=(page_content.findAll('div',attrs={"id":"col-green"}))
soup = BeautifulSoup(source_code) #error line here...
Ошибка в том, что:
Warning (from warnings module):
File "C:/Users/Emre/Desktop/python.py", line 7
soup = BeautifulSoup(source_code)
UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 7 of the file C:/Users/Emre/Desktop/python.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.