How to resolve BeautifulSoup's FutureWarning and MarkupResemblesLocatorWarning
FutureWarning
- Wrapping an html string into a StringIO object.
MarkupResemblesLocatorWarning
- Open the file and pass the file handle to BeautifulSoup.
# example
from io import StringIO
import pandas as pd
from bs4 import BeautifulSoup
with open(file_path, 'r', encoding='utf-8') as file:
html_content = file.read()
soup = BeautifulSoup(html_content, 'html.parser')
html_io = StringIO(str(soup))
data = pd.read_html(html_io, header=0)
Hello, my name is Koki. I am currently learning the web framework Django and English. In my free time, I enjoy hiking, cycling, and visiting shrines and temples. At work, I make software for programmable logic controllers (PLCs), I work especially with OMRON and Mitsubishi PLCs. Please feel free to contact me for any inquiries, job requests, or just to chat. We look forward to hearing from you via email!