Adicionando "encoding" no BeautifulSoup 4 para evitar problemas com caracteres
This commit is contained in:
@@ -14,8 +14,8 @@ from bs4 import BeautifulSoup
|
||||
|
||||
url = 'http://127.0.0.1:3333/'
|
||||
response = requests.get(url)
|
||||
raw_html = response.text
|
||||
parsed_html = BeautifulSoup(raw_html, 'html.parser')
|
||||
bytes_html = response.content
|
||||
parsed_html = BeautifulSoup(bytes_html, 'html.parser', from_encoding='utf-8')
|
||||
|
||||
# if parsed_html.title is not None:
|
||||
# print(parsed_html.title.text)
|
||||
|
||||
Reference in New Issue
Block a user