要确定BeautifulSoup对象的类型,可以使用type()函数。以下是一个示例代码:
from bs4 import BeautifulSoup
html = '''
BeautifulSoup Test
Hello World
This is a test.
'''
soup = BeautifulSoup(html, 'html.parser')
print(type(soup))
输出结果将会是:
这表明soup对象的类型是BeautifulSoup。