poem_title = poem.find("b").text # 获取诗作者 poem_author = poem.find("p", class_="source").text.strip() # 获取诗内容 poem_content = poem.find("div", class_="contson").text.strip() # 创建诗对象,添加到诗列表中 poem_obj = { "type": poem_type, "title": poem_title, "author": poem_author, "content": poem_content } poems.append(poem_obj) return poems [2024-06-24 00:59:22 | GPT-代码助手 | 316字解答]