要使用BeautifulSoup库找到类似自定义标签,可以通过以下步骤解决:
from bs4 import BeautifulSoup
html_doc = """
Example
Some content
"""
soup = BeautifulSoup(html_doc, 'html.parser')
custom_tags = soup.find_all('custom-tag')
for tag in custom_tags:
print(tag.text)
输出:
Some content
这样就可以使用BeautifulSoup库找到类似自定义标签的元素,并对其进行操作。