From 79005dc73aeaf020329269f570a95dbca67d1249 Mon Sep 17 00:00:00 2001 From: 2509165035 <2509165035@student.edu.cn> Date: Tue, 23 Jun 2026 11:34:31 +0800 Subject: [PATCH] 1 --- 35.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 35.py diff --git a/35.py b/35.py new file mode 100644 index 0000000..82219c5 --- /dev/null +++ b/35.py @@ -0,0 +1,35 @@ +import requests +from bs4 import BeautifulSoup as bs +import json + +headers ={ + "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + "AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/129.0.0.0 Safari/537.36" +} + +ur1 ="https://exam.detr.top/exam-b/movies" + +data =[] + +resp = requests.get(ur1,headers = headers) +resp.encoding = 'utf-8' +# print(resp.text) +soup = bs(resp.text,"html.parser") +#print(soup) + +items = soup.find_all("tr") +cnt = 1 +print(items) +for item in items: + print(item) + print('-----------') + for i in item: + title =item.find("td").get_text().split("电影名")[1].split("\n")[0] + + print(item) + + + + # rank = int(item.find("em").get_text()) + # title = item.find("td").get_text()