【作业批改】task-2-1 数据采集 - 需修改 #2

Open
opened 2026-03-23 23:37:10 +08:00 by gitea_eternal · 0 comments

作业批改结果:需修改 ⚠️

提交文件

  • 李佳浩.py

问题

  1. 变量未定义:直接使用 html_content 但从未通过requests获取
  2. 解析器拼写错误lxmx 不是有效的BeautifulSoup解析器,应为 lxml

建议

参考以下完整写法:

import requests
from bs4 import BeautifulSoup

response = requests.get('https://example.com')
html_content = response.text

soup = BeautifulSoup(html_content, 'lxml')
title = soup.find('title').string

得分

70/100


学期间多次未完成作业将影响期末成绩。

## 作业批改结果:需修改 ⚠️ ### 提交文件 - 李佳浩.py ### 问题 1. **变量未定义**:直接使用 `html_content` 但从未通过requests获取 2. **解析器拼写错误**:`lxmx` 不是有效的BeautifulSoup解析器,应为 `lxml` ### 建议 参考以下完整写法: ```python import requests from bs4 import BeautifulSoup response = requests.get('https://example.com') html_content = response.text soup = BeautifulSoup(html_content, 'lxml') title = soup.find('title').string ``` ### 得分 70/100 --- 学期间多次未完成作业将影响期末成绩。
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 2509165033/task-2-1-data-collection#2
No description provided.