酷代码 AI
菜单
服务商

Python实现:轻松爬取古诗网唐诗信息

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 ######[AI写代码神器 | 316点数解答 | 2024-06-24 00:59:22]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]