From d2280a46aa2357879bad34176171acd236f8d0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Ot=C3=A1vio?= Date: Tue, 24 Jan 2023 10:32:17 -0300 Subject: [PATCH] Adicionando "encoding" no BeautifulSoup 4 para evitar problemas com caracteres --- aula192.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aula192.py b/aula192.py index 6bfe284..a25d3aa 100644 --- a/aula192.py +++ b/aula192.py @@ -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)