From 9827f2f165178ec0b298d4871b456044805fa93b Mon Sep 17 00:00:00 2001 From: 2509165013 <2509165013@student.edu.cn> Date: Thu, 19 Mar 2026 16:01:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A=E4=B8=80?= =?UTF-8?q?=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 zsk.py diff --git a/zsk.py b/zsk.py new file mode 100644 index 0000000..744e621 --- /dev/null +++ b/zsk.py @@ -0,0 +1,10 @@ +from bs4 import BeautifulSoup +soup = BeautifulSoup(html_content, 'lxml') +title = soup.find('title').string +print("页面标题:", title) +links = soup.find_all('a') +for link in links: + print("链接地址:",link.get('href')) +div_elements = soup.select('div.class_name') +for div in div_element: + print("div内容:", div.text) \ No newline at end of file