试试这个:
title.get_text()
你的标题不是字符串,而是一个对象
从BeautifulSoup文档:
The find_all() method looks through a tagâs descendants and retrieves all descendants that match your filters.
为了你的 标题 变量,您可以参考bs4。要素标记文档,如果您有疑问,可以随时打印该对象的所有可用方法,如下所示:
print(dir(title))