酷代码 AI
菜单
全部AI  /  热门  /  AI写代码神器
服务商

任务一:采集唐诗三百首内容 python import requests from bs4 import beautifulsoup import pandas as pd url = "https://so.gushiwen.cn/gushi/tangshi.aspx" response = requests.get(url) soup = beautifulsoup(response.text, "html.parser") poems = [] for poem in soup.find_all("div", class_="item"): title = poem.find("h1").text.strip() content = poem.find("p").text.strip() author = poem.find("span", class_="author").text.strip() poem_type = "唐诗" poems.append(

服务器繁忙,请稍后再试 [2024-06-24 15:46:11 | AI写代码神器 | 15点数解答]

相关提问