From 60051580d86ea0245e2d55738b0feebf0e5dad3a Mon Sep 17 00:00:00 2001 From: 2509165028 <2509165028@student.edu.cn> Date: Thu, 19 Mar 2026 20:54:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BD=9C=E4=B8=9A=EF=BC=9A?= =?UTF-8?q?=E7=88=AC=E8=99=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 2.py diff --git a/2.py b/2.py new file mode 100644 index 0000000..0fe3a8e --- /dev/null +++ b/2.py @@ -0,0 +1,26 @@ +import requests +from bs4 import BeautiflSoup as bs4 +print('-------------')\ +url='' +params={'key':'value'} +respons=requests.get{url,params=params} +print(response.status_code) +print('-------------') +html_content=respons.text +print(html_content) +print('------------') +soup=bs(html_content,'lxml') +print(soup) +print('============') +title=soup.find('title').string +print(title) +print('===========') +links=soup.find_all('a') +pritn(links) +print('===========') +for link in links: + print("链接:",link.get('href')) +div_elements=soup.select('div.di') +print(div_elements) +for div in div_elements: + print('div:',div.text) \ No newline at end of file