Compare commits
2 Commits
a48acdad25
...
35ae6fc7fd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35ae6fc7fd | ||
|
|
7b30a83ff8 |
33038
get-pip.py
Normal file
33038
get-pip.py
Normal file
File diff suppressed because it is too large
Load Diff
186
movies.html
186
movies.html
@@ -1,5 +1,5 @@
|
|||||||
<!-- exam_fingerprint: B-20260623-9165 -->
|
<!-- exam_fingerprint: B-20260705-9162 -->
|
||||||
<!-- server_time: 2026-06-23 11:05:22 -->
|
<!-- server_time: 2026-07-05 21:45:58 -->
|
||||||
<!-- exam_paper: B -->
|
<!-- exam_paper: B -->
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>电影列表</h1>
|
<h1>电影列表</h1>
|
||||||
<p class="meta">数据编号:<code>B-20260623-9165</code></p>
|
<p class="meta">数据编号:<code>B-20260705-9162</code></p>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -36,114 +36,114 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>1</td>
|
<td class="item-id">1</td>
|
||||||
<td>肖申克的救赎</td>
|
<td class="item-title">放牛班的春天</td>
|
||||||
<td>Frank Darabont</td>
|
<td class="item-director">Frank Darabont</td>
|
||||||
<td>2006</td>
|
<td class="item-year">2007</td>
|
||||||
<td>7.0</td>
|
<td class="item-rating">8.9</td>
|
||||||
<td>110</td>
|
<td class="item-duration">155</td>
|
||||||
<td>爱情</td>
|
<td class="item-genre">悬疑</td>
|
||||||
<td>5</td>
|
<td class="item-actors-count">5</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>2</td>
|
<td class="item-id">2</td>
|
||||||
<td>三傻大闹宝莱坞</td>
|
<td class="item-title">霸王别姬</td>
|
||||||
<td>陈凯歌</td>
|
<td class="item-director">陈凯歌</td>
|
||||||
<td>1997</td>
|
<td class="item-year">2018</td>
|
||||||
<td>6.7</td>
|
<td class="item-rating">6.6</td>
|
||||||
<td>102</td>
|
<td class="item-duration">143</td>
|
||||||
<td>悬疑</td>
|
<td class="item-genre">剧情</td>
|
||||||
<td>3</td>
|
<td class="item-actors-count">4</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>3</td>
|
<td class="item-id">3</td>
|
||||||
<td>千与千寻</td>
|
<td class="item-title">星际穿越</td>
|
||||||
<td>Robert Zemeckis</td>
|
<td class="item-director">Robert Zemeckis</td>
|
||||||
<td>1994</td>
|
<td class="item-year">2018</td>
|
||||||
<td>6.9</td>
|
<td class="item-rating">8.4</td>
|
||||||
<td>146</td>
|
<td class="item-duration">165</td>
|
||||||
<td>动画</td>
|
<td class="item-genre">悬疑</td>
|
||||||
<td>5</td>
|
<td class="item-actors-count">5</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>4</td>
|
<td class="item-id">4</td>
|
||||||
<td>放牛班的春天</td>
|
<td class="item-title">肖申克的救赎</td>
|
||||||
<td>James Cameron</td>
|
<td class="item-director">James Cameron</td>
|
||||||
<td>2007</td>
|
<td class="item-year">2008</td>
|
||||||
<td>7.3</td>
|
<td class="item-rating">8.6</td>
|
||||||
<td>162</td>
|
<td class="item-duration">124</td>
|
||||||
<td>悬疑</td>
|
<td class="item-genre">剧情</td>
|
||||||
<td>3</td>
|
<td class="item-actors-count">5</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>5</td>
|
<td class="item-id">5</td>
|
||||||
<td>泰坦尼克号</td>
|
<td class="item-title">盗梦空间</td>
|
||||||
<td>宫崎骏</td>
|
<td class="item-director">宫崎骏</td>
|
||||||
<td>1996</td>
|
<td class="item-year">1993</td>
|
||||||
<td>6.2</td>
|
<td class="item-rating">7.8</td>
|
||||||
<td>105</td>
|
<td class="item-duration">90</td>
|
||||||
<td>悬疑</td>
|
<td class="item-genre">爱情</td>
|
||||||
<td>4</td>
|
<td class="item-actors-count">2</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>6</td>
|
<td class="item-id">6</td>
|
||||||
<td>盗梦空间</td>
|
<td class="item-title">泰坦尼克号</td>
|
||||||
<td>Christopher Nolan</td>
|
<td class="item-director">Christopher Nolan</td>
|
||||||
<td>2024</td>
|
<td class="item-year">2001</td>
|
||||||
<td>8.6</td>
|
<td class="item-rating">6.7</td>
|
||||||
<td>166</td>
|
<td class="item-duration">175</td>
|
||||||
<td>科幻</td>
|
<td class="item-genre">喜剧</td>
|
||||||
<td>4</td>
|
<td class="item-actors-count">4</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>7</td>
|
<td class="item-id">7</td>
|
||||||
<td>星际穿越</td>
|
<td class="item-title">忠犬八公的故事</td>
|
||||||
<td>Lasse Hallström</td>
|
<td class="item-director">Lasse Hallström</td>
|
||||||
<td>2018</td>
|
<td class="item-year">2004</td>
|
||||||
<td>6.5</td>
|
<td class="item-rating">8.2</td>
|
||||||
<td>152</td>
|
<td class="item-duration">91</td>
|
||||||
<td>喜剧</td>
|
<td class="item-genre">动画</td>
|
||||||
<td>5</td>
|
<td class="item-actors-count">3</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>8</td>
|
<td class="item-id">8</td>
|
||||||
<td>阿甘正传</td>
|
<td class="item-title">三傻大闹宝莱坞</td>
|
||||||
<td>Rajkumar Hirani</td>
|
<td class="item-director">Rajkumar Hirani</td>
|
||||||
<td>2002</td>
|
<td class="item-year">2011</td>
|
||||||
<td>8.9</td>
|
<td class="item-rating">6.3</td>
|
||||||
<td>112</td>
|
<td class="item-duration">175</td>
|
||||||
<td>剧情</td>
|
<td class="item-genre">冒险</td>
|
||||||
<td>4</td>
|
<td class="item-actors-count">3</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>9</td>
|
<td class="item-id">9</td>
|
||||||
<td>霸王别姬</td>
|
<td class="item-title">阿甘正传</td>
|
||||||
<td>Christophe Barratier</td>
|
<td class="item-director">Christophe Barratier</td>
|
||||||
<td>2005</td>
|
<td class="item-year">2022</td>
|
||||||
<td>9.3</td>
|
<td class="item-rating">7.9</td>
|
||||||
<td>149</td>
|
<td class="item-duration">107</td>
|
||||||
<td>悬疑</td>
|
<td class="item-genre">动画</td>
|
||||||
<td>2</td>
|
<td class="item-actors-count">4</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr class="item-row">
|
||||||
<td>10</td>
|
<td class="item-id">10</td>
|
||||||
<td>忠犬八公的故事</td>
|
<td class="item-title">千与千寻</td>
|
||||||
<td>Christopher Nolan</td>
|
<td class="item-director">Christopher Nolan</td>
|
||||||
<td>1996</td>
|
<td class="item-year">1993</td>
|
||||||
<td>6.3</td>
|
<td class="item-rating">7.2</td>
|
||||||
<td>128</td>
|
<td class="item-duration">129</td>
|
||||||
<td>冒险</td>
|
<td class="item-genre">悬疑</td>
|
||||||
<td>4</td>
|
<td class="item-actors-count">3</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
162
movies.json
162
movies.json
@@ -1,105 +1,105 @@
|
|||||||
{
|
{
|
||||||
"data_code": "B-20260623-9165",
|
"data_code": "B-20260705-9162",
|
||||||
"movies": [
|
"movies": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"title": "肖申克的救赎",
|
"title": "放牛班的春天",
|
||||||
"director": "Frank Darabont",
|
"director": "Frank Darabont",
|
||||||
"year": 2006,
|
"year": 2007,
|
||||||
"rating": 7.0,
|
"rating": 8.9,
|
||||||
"duration": 110,
|
"duration": 155,
|
||||||
"genre": "爱情",
|
"genre": "悬疑",
|
||||||
"actors_count": 5
|
"actors_count": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"title": "三傻大闹宝莱坞",
|
"title": "霸王别姬",
|
||||||
"director": "陈凯歌",
|
"director": "陈凯歌",
|
||||||
"year": 1997,
|
|
||||||
"rating": 6.7,
|
|
||||||
"duration": 102,
|
|
||||||
"genre": "悬疑",
|
|
||||||
"actors_count": 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 3,
|
|
||||||
"title": "千与千寻",
|
|
||||||
"director": "Robert Zemeckis",
|
|
||||||
"year": 1994,
|
|
||||||
"rating": 6.9,
|
|
||||||
"duration": 146,
|
|
||||||
"genre": "动画",
|
|
||||||
"actors_count": 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 4,
|
|
||||||
"title": "放牛班的春天",
|
|
||||||
"director": "James Cameron",
|
|
||||||
"year": 2007,
|
|
||||||
"rating": 7.3,
|
|
||||||
"duration": 162,
|
|
||||||
"genre": "悬疑",
|
|
||||||
"actors_count": 3
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 5,
|
|
||||||
"title": "泰坦尼克号",
|
|
||||||
"director": "宫崎骏",
|
|
||||||
"year": 1996,
|
|
||||||
"rating": 6.2,
|
|
||||||
"duration": 105,
|
|
||||||
"genre": "悬疑",
|
|
||||||
"actors_count": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 6,
|
|
||||||
"title": "盗梦空间",
|
|
||||||
"director": "Christopher Nolan",
|
|
||||||
"year": 2024,
|
|
||||||
"rating": 8.6,
|
|
||||||
"duration": 166,
|
|
||||||
"genre": "科幻",
|
|
||||||
"actors_count": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 7,
|
|
||||||
"title": "星际穿越",
|
|
||||||
"director": "Lasse Hallström",
|
|
||||||
"year": 2018,
|
"year": 2018,
|
||||||
"rating": 6.5,
|
"rating": 6.6,
|
||||||
"duration": 152,
|
"duration": 143,
|
||||||
"genre": "喜剧",
|
|
||||||
"actors_count": 5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 8,
|
|
||||||
"title": "阿甘正传",
|
|
||||||
"director": "Rajkumar Hirani",
|
|
||||||
"year": 2002,
|
|
||||||
"rating": 8.9,
|
|
||||||
"duration": 112,
|
|
||||||
"genre": "剧情",
|
"genre": "剧情",
|
||||||
"actors_count": 4
|
"actors_count": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 3,
|
||||||
"title": "霸王别姬",
|
"title": "星际穿越",
|
||||||
"director": "Christophe Barratier",
|
"director": "Robert Zemeckis",
|
||||||
"year": 2005,
|
"year": 2018,
|
||||||
"rating": 9.3,
|
"rating": 8.4,
|
||||||
"duration": 149,
|
"duration": 165,
|
||||||
"genre": "悬疑",
|
"genre": "悬疑",
|
||||||
|
"actors_count": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"title": "肖申克的救赎",
|
||||||
|
"director": "James Cameron",
|
||||||
|
"year": 2008,
|
||||||
|
"rating": 8.6,
|
||||||
|
"duration": 124,
|
||||||
|
"genre": "剧情",
|
||||||
|
"actors_count": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"title": "盗梦空间",
|
||||||
|
"director": "宫崎骏",
|
||||||
|
"year": 1993,
|
||||||
|
"rating": 7.8,
|
||||||
|
"duration": 90,
|
||||||
|
"genre": "爱情",
|
||||||
"actors_count": 2
|
"actors_count": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 10,
|
"id": 6,
|
||||||
"title": "忠犬八公的故事",
|
"title": "泰坦尼克号",
|
||||||
"director": "Christopher Nolan",
|
"director": "Christopher Nolan",
|
||||||
"year": 1996,
|
"year": 2001,
|
||||||
"rating": 6.3,
|
"rating": 6.7,
|
||||||
"duration": 128,
|
"duration": 175,
|
||||||
"genre": "冒险",
|
"genre": "喜剧",
|
||||||
"actors_count": 4
|
"actors_count": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"title": "忠犬八公的故事",
|
||||||
|
"director": "Lasse Hallström",
|
||||||
|
"year": 2004,
|
||||||
|
"rating": 8.2,
|
||||||
|
"duration": 91,
|
||||||
|
"genre": "动画",
|
||||||
|
"actors_count": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"title": "三傻大闹宝莱坞",
|
||||||
|
"director": "Rajkumar Hirani",
|
||||||
|
"year": 2011,
|
||||||
|
"rating": 6.3,
|
||||||
|
"duration": 175,
|
||||||
|
"genre": "冒险",
|
||||||
|
"actors_count": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"title": "阿甘正传",
|
||||||
|
"director": "Christophe Barratier",
|
||||||
|
"year": 2022,
|
||||||
|
"rating": 7.9,
|
||||||
|
"duration": 107,
|
||||||
|
"genre": "动画",
|
||||||
|
"actors_count": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"title": "千与千寻",
|
||||||
|
"director": "Christopher Nolan",
|
||||||
|
"year": 1993,
|
||||||
|
"rating": 7.2,
|
||||||
|
"duration": 129,
|
||||||
|
"genre": "悬疑",
|
||||||
|
"actors_count": 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,87 +1,176 @@
|
|||||||
import requests
|
<<<<<<< HEAD
|
||||||
import json
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
import json
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
url = "https://exam.detr.top/exam-b/movies"
|
|
||||||
headers = {
|
url = "https://exam.detr.top/exam-b/movies"
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
headers = {
|
||||||
}
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||||
|
}
|
||||||
resp = requests.get(url, headers=headers)
|
|
||||||
resp.encoding = resp.apparent_encoding
|
resp = requests.get(url, headers=headers)
|
||||||
html_source = resp.text
|
resp.encoding = resp.apparent_encoding
|
||||||
|
html_source = resp.text
|
||||||
with open("movies.html", "w", encoding="utf-8") as f:
|
|
||||||
f.write(html_source)
|
with open("movies.html", "w", encoding="utf-8") as f:
|
||||||
print("已保存原始网页:movies.html")
|
f.write(html_source)
|
||||||
|
print("已保存原始网页:movies.html")
|
||||||
soup = BeautifulSoup(html_source, "html.parser")
|
|
||||||
|
soup = BeautifulSoup(html_source, "html.parser")
|
||||||
code_text = soup.find("code").get_text(strip=True)
|
|
||||||
data_id = code_text.split(":")[-1].strip()
|
code_text = soup.find("code").get_text(strip=True)
|
||||||
|
data_id = code_text.split(":")[-1].strip()
|
||||||
table_rows = soup.find("table").find_all("tr")[1:]
|
|
||||||
movie_list = []
|
table_rows = soup.find("table").find_all("tr")[1:]
|
||||||
|
movie_list = []
|
||||||
for row in table_rows:
|
|
||||||
tds = row.find_all("td")
|
for row in table_rows:
|
||||||
movie_info = {
|
tds = row.find_all("td")
|
||||||
"id": int(tds[0].text),
|
movie_info = {
|
||||||
"title": tds[1].text,
|
"id": int(tds[0].text),
|
||||||
"director": tds[2].text,
|
"title": tds[1].text,
|
||||||
"year": int(tds[3].text),
|
"director": tds[2].text,
|
||||||
"rating": float(tds[4].text),
|
"year": int(tds[3].text),
|
||||||
"duration": int(tds[5].text),
|
"rating": float(tds[4].text),
|
||||||
"genre": tds[6].text,
|
"duration": int(tds[5].text),
|
||||||
"actors_count": int(tds[7].text)
|
"genre": tds[6].text,
|
||||||
}
|
"actors_count": int(tds[7].text)
|
||||||
movie_list.append(movie_info)
|
}
|
||||||
|
movie_list.append(movie_info)
|
||||||
# 组装json总数据
|
|
||||||
json_data = {
|
# 组装json总数据
|
||||||
"data_code": data_id,
|
json_data = {
|
||||||
"movies": movie_list
|
"data_code": data_id,
|
||||||
}
|
"movies": movie_list
|
||||||
|
}
|
||||||
# 保存movies.json
|
|
||||||
with open("movies.json", "w", encoding="utf-8") as f:
|
# 保存movies.json
|
||||||
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
with open("movies.json", "w", encoding="utf-8") as f:
|
||||||
print("已保存电影数据:movies.json")
|
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
||||||
|
print("已保存电影数据:movies.json")
|
||||||
# ====================== 第2题:读取movies.json进行数据分析 ======================
|
|
||||||
# 读取json文件
|
# ====================== 第2题:读取movies.json进行数据分析 ======================
|
||||||
with open("movies.json", "r", encoding="utf-8") as f:
|
# 读取json文件
|
||||||
load_data = json.load(f)
|
with open("movies.json", "r", encoding="utf-8") as f:
|
||||||
movies = load_data["movies"]
|
load_data = json.load(f)
|
||||||
|
movies = load_data["movies"]
|
||||||
# ① 找出评分最高、最低电影
|
|
||||||
sorted_by_rating = sorted(movies, key=lambda x: x["rating"])
|
# ① 找出评分最高、最低电影
|
||||||
min_movie = sorted_by_rating[0]
|
sorted_by_rating = sorted(movies, key=lambda x: x["rating"])
|
||||||
max_movie = sorted_by_rating[-1]
|
min_movie = sorted_by_rating[0]
|
||||||
print("\n===== ① 评分最高/最低电影 =====")
|
max_movie = sorted_by_rating[-1]
|
||||||
print(f"评分最低:{min_movie['title']} {min_movie['rating']}")
|
print("\n===== ① 评分最高/最低电影 =====")
|
||||||
print(f"评分最高:{max_movie['title']} {max_movie['rating']}")
|
print(f"评分最低:{min_movie['title']} {min_movie['rating']}")
|
||||||
|
print(f"评分最高:{max_movie['title']} {max_movie['rating']}")
|
||||||
# ② 统计各类型电影数量
|
|
||||||
genre_count = {}
|
# ② 统计各类型电影数量
|
||||||
for m in movies:
|
genre_count = {}
|
||||||
g = m["genre"]
|
for m in movies:
|
||||||
genre_count[g] = genre_count.get(g, 0) + 1
|
g = m["genre"]
|
||||||
print("\n===== ② 各类型电影数量 =====")
|
genre_count[g] = genre_count.get(g, 0) + 1
|
||||||
print(genre_count)
|
print("\n===== ② 各类型电影数量 =====")
|
||||||
|
print(genre_count)
|
||||||
# ③ 统计各导演电影数量
|
|
||||||
director_count = {}
|
# ③ 统计各导演电影数量
|
||||||
for m in movies:
|
director_count = {}
|
||||||
d = m["director"]
|
for m in movies:
|
||||||
director_count[d] = director_count.get(d, 0) + 1
|
d = m["director"]
|
||||||
print("\n===== ③ 各导演电影数量 =====")
|
director_count[d] = director_count.get(d, 0) + 1
|
||||||
print(director_count)
|
print("\n===== ③ 各导演电影数量 =====")
|
||||||
|
print(director_count)
|
||||||
# ④ 统计2020年(含)以后上映电影数量
|
|
||||||
cnt_after_2020 = 0
|
# ④ 统计2020年(含)以后上映电影数量
|
||||||
for m in movies:
|
cnt_after_2020 = 0
|
||||||
if m["year"] >= 2020:
|
for m in movies:
|
||||||
cnt_after_2020 += 1
|
if m["year"] >= 2020:
|
||||||
print("\n===== ④ 2020年(含)后上映电影总数 =====")
|
cnt_after_2020 += 1
|
||||||
|
print("\n===== ④ 2020年(含)后上映电影总数 =====")
|
||||||
|
=======
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
url = "https://exam.detr.top/exam-b/movies"
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||||
|
}
|
||||||
|
|
||||||
|
resp = requests.get(url, headers=headers)
|
||||||
|
resp.encoding = resp.apparent_encoding
|
||||||
|
html_source = resp.text
|
||||||
|
|
||||||
|
with open("movies.html", "w", encoding="utf-8") as f:
|
||||||
|
f.write(html_source)
|
||||||
|
print("已保存原始网页:movies.html")
|
||||||
|
|
||||||
|
soup = BeautifulSoup(html_source, "html.parser")
|
||||||
|
|
||||||
|
code_text = soup.find("code").get_text(strip=True)
|
||||||
|
data_id = code_text.split(":")[-1].strip()
|
||||||
|
|
||||||
|
table_rows = soup.find("table").find_all("tr")[1:]
|
||||||
|
movie_list = []
|
||||||
|
|
||||||
|
for row in table_rows:
|
||||||
|
tds = row.find_all("td")
|
||||||
|
movie_info = {
|
||||||
|
"id": int(tds[0].text),
|
||||||
|
"title": tds[1].text,
|
||||||
|
"director": tds[2].text,
|
||||||
|
"year": int(tds[3].text),
|
||||||
|
"rating": float(tds[4].text),
|
||||||
|
"duration": int(tds[5].text),
|
||||||
|
"genre": tds[6].text,
|
||||||
|
"actors_count": int(tds[7].text)
|
||||||
|
}
|
||||||
|
movie_list.append(movie_info)
|
||||||
|
|
||||||
|
# 组装json总数据
|
||||||
|
json_data = {
|
||||||
|
"data_code": data_id,
|
||||||
|
"movies": movie_list
|
||||||
|
}
|
||||||
|
|
||||||
|
# 保存movies.json
|
||||||
|
with open("movies.json", "w", encoding="utf-8") as f:
|
||||||
|
json.dump(json_data, f, ensure_ascii=False, indent=4)
|
||||||
|
print("已保存电影数据:movies.json")
|
||||||
|
|
||||||
|
# ====================== 第2题:读取movies.json进行数据分析 ======================
|
||||||
|
# 读取json文件
|
||||||
|
with open("movies.json", "r", encoding="utf-8") as f:
|
||||||
|
load_data = json.load(f)
|
||||||
|
movies = load_data["movies"]
|
||||||
|
|
||||||
|
# ① 找出评分最高、最低电影
|
||||||
|
sorted_by_rating = sorted(movies, key=lambda x: x["rating"])
|
||||||
|
min_movie = sorted_by_rating[0]
|
||||||
|
max_movie = sorted_by_rating[-1]
|
||||||
|
print("\n===== ① 评分最高/最低电影 =====")
|
||||||
|
print(f"评分最低:{min_movie['title']} {min_movie['rating']}")
|
||||||
|
print(f"评分最高:{max_movie['title']} {max_movie['rating']}")
|
||||||
|
|
||||||
|
# ② 统计各类型电影数量
|
||||||
|
genre_count = {}
|
||||||
|
for m in movies:
|
||||||
|
g = m["genre"]
|
||||||
|
genre_count[g] = genre_count.get(g, 0) + 1
|
||||||
|
print("\n===== ② 各类型电影数量 =====")
|
||||||
|
print(genre_count)
|
||||||
|
|
||||||
|
# ③ 统计各导演电影数量
|
||||||
|
director_count = {}
|
||||||
|
for m in movies:
|
||||||
|
d = m["director"]
|
||||||
|
director_count[d] = director_count.get(d, 0) + 1
|
||||||
|
print("\n===== ③ 各导演电影数量 =====")
|
||||||
|
print(director_count)
|
||||||
|
|
||||||
|
# ④ 统计2020年(含)以后上映电影数量
|
||||||
|
cnt_after_2020 = 0
|
||||||
|
for m in movies:
|
||||||
|
if m["year"] >= 2020:
|
||||||
|
cnt_after_2020 += 1
|
||||||
|
print("\n===== ④ 2020年(含)后上映电影总数 =====")
|
||||||
|
>>>>>>> a48acdad2552a0dd4f3db2345ad8092003820c28
|
||||||
print(cnt_after_2020)
|
print(cnt_after_2020)
|
||||||
@@ -1,152 +1,306 @@
|
|||||||
<!-- exam_fingerprint: B-20260705-9162 -->
|
<<<<<<< HEAD
|
||||||
<!-- server_time: 2026-07-05 21:45:58 -->
|
<!-- exam_fingerprint: B-20260705-9162 -->
|
||||||
<!-- exam_paper: B -->
|
<!-- server_time: 2026-07-05 21:45:58 -->
|
||||||
<!DOCTYPE html>
|
<!-- exam_paper: B -->
|
||||||
<html lang="zh-CN">
|
<!DOCTYPE html>
|
||||||
<head>
|
<html lang="zh-CN">
|
||||||
<meta charset="UTF-8">
|
<head>
|
||||||
<title>电影列表</title>
|
<meta charset="UTF-8">
|
||||||
<style>
|
<title>电影列表</title>
|
||||||
body { font-family: "Microsoft YaHei", sans-serif; margin: 20px; background: #f5f5f5; }
|
<style>
|
||||||
h1 { color: #c0392b; }
|
body { font-family: "Microsoft YaHei", sans-serif; margin: 20px; background: #f5f5f5; }
|
||||||
.meta { color: #999; font-size: 12px; margin-bottom: 15px; }
|
h1 { color: #c0392b; }
|
||||||
.meta code { background: #e9ecef; padding: 2px 6px; border-radius: 3px; }
|
.meta { color: #999; font-size: 12px; margin-bottom: 15px; }
|
||||||
table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
.meta code { background: #e9ecef; padding: 2px 6px; border-radius: 3px; }
|
||||||
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
|
table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||||
th { background: #c0392b; color: white; }
|
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
|
||||||
tr:hover { background: #fef5f4; }
|
th { background: #c0392b; color: white; }
|
||||||
</style>
|
tr:hover { background: #fef5f4; }
|
||||||
</head>
|
</style>
|
||||||
<body>
|
</head>
|
||||||
<h1>电影列表</h1>
|
<body>
|
||||||
<p class="meta">数据编号:<code>B-20260705-9162</code></p>
|
<h1>电影列表</h1>
|
||||||
|
<p class="meta">数据编号:<code>B-20260705-9162</code></p>
|
||||||
<table>
|
|
||||||
<thead>
|
<table>
|
||||||
<tr>
|
<thead>
|
||||||
<th>编号</th>
|
<tr>
|
||||||
<th>电影名</th>
|
<th>编号</th>
|
||||||
<th>导演</th>
|
<th>电影名</th>
|
||||||
<th>上映年份</th>
|
<th>导演</th>
|
||||||
<th>评分</th>
|
<th>上映年份</th>
|
||||||
<th>时长(分钟)</th>
|
<th>评分</th>
|
||||||
<th>类型</th>
|
<th>时长(分钟)</th>
|
||||||
<th>主演数</th>
|
<th>类型</th>
|
||||||
</tr>
|
<th>主演数</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
|
<tbody>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">1</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">放牛班的春天</td>
|
<td class="item-id">1</td>
|
||||||
<td class="item-director">Frank Darabont</td>
|
<td class="item-title">放牛班的春天</td>
|
||||||
<td class="item-year">2007</td>
|
<td class="item-director">Frank Darabont</td>
|
||||||
<td class="item-rating">8.9</td>
|
<td class="item-year">2007</td>
|
||||||
<td class="item-duration">155</td>
|
<td class="item-rating">8.9</td>
|
||||||
<td class="item-genre">悬疑</td>
|
<td class="item-duration">155</td>
|
||||||
<td class="item-actors-count">5</td>
|
<td class="item-genre">悬疑</td>
|
||||||
</tr>
|
<td class="item-actors-count">5</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">2</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">霸王别姬</td>
|
<td class="item-id">2</td>
|
||||||
<td class="item-director">陈凯歌</td>
|
<td class="item-title">霸王别姬</td>
|
||||||
<td class="item-year">2018</td>
|
<td class="item-director">陈凯歌</td>
|
||||||
<td class="item-rating">6.6</td>
|
<td class="item-year">2018</td>
|
||||||
<td class="item-duration">143</td>
|
<td class="item-rating">6.6</td>
|
||||||
<td class="item-genre">剧情</td>
|
<td class="item-duration">143</td>
|
||||||
<td class="item-actors-count">4</td>
|
<td class="item-genre">剧情</td>
|
||||||
</tr>
|
<td class="item-actors-count">4</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">3</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">星际穿越</td>
|
<td class="item-id">3</td>
|
||||||
<td class="item-director">Robert Zemeckis</td>
|
<td class="item-title">星际穿越</td>
|
||||||
<td class="item-year">2018</td>
|
<td class="item-director">Robert Zemeckis</td>
|
||||||
<td class="item-rating">8.4</td>
|
<td class="item-year">2018</td>
|
||||||
<td class="item-duration">165</td>
|
<td class="item-rating">8.4</td>
|
||||||
<td class="item-genre">悬疑</td>
|
<td class="item-duration">165</td>
|
||||||
<td class="item-actors-count">5</td>
|
<td class="item-genre">悬疑</td>
|
||||||
</tr>
|
<td class="item-actors-count">5</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">4</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">肖申克的救赎</td>
|
<td class="item-id">4</td>
|
||||||
<td class="item-director">James Cameron</td>
|
<td class="item-title">肖申克的救赎</td>
|
||||||
<td class="item-year">2008</td>
|
<td class="item-director">James Cameron</td>
|
||||||
<td class="item-rating">8.6</td>
|
<td class="item-year">2008</td>
|
||||||
<td class="item-duration">124</td>
|
<td class="item-rating">8.6</td>
|
||||||
<td class="item-genre">剧情</td>
|
<td class="item-duration">124</td>
|
||||||
<td class="item-actors-count">5</td>
|
<td class="item-genre">剧情</td>
|
||||||
</tr>
|
<td class="item-actors-count">5</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">5</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">盗梦空间</td>
|
<td class="item-id">5</td>
|
||||||
<td class="item-director">宫崎骏</td>
|
<td class="item-title">盗梦空间</td>
|
||||||
<td class="item-year">1993</td>
|
<td class="item-director">宫崎骏</td>
|
||||||
<td class="item-rating">7.8</td>
|
<td class="item-year">1993</td>
|
||||||
<td class="item-duration">90</td>
|
<td class="item-rating">7.8</td>
|
||||||
<td class="item-genre">爱情</td>
|
<td class="item-duration">90</td>
|
||||||
<td class="item-actors-count">2</td>
|
<td class="item-genre">爱情</td>
|
||||||
</tr>
|
<td class="item-actors-count">2</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">6</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">泰坦尼克号</td>
|
<td class="item-id">6</td>
|
||||||
<td class="item-director">Christopher Nolan</td>
|
<td class="item-title">泰坦尼克号</td>
|
||||||
<td class="item-year">2001</td>
|
<td class="item-director">Christopher Nolan</td>
|
||||||
<td class="item-rating">6.7</td>
|
<td class="item-year">2001</td>
|
||||||
<td class="item-duration">175</td>
|
<td class="item-rating">6.7</td>
|
||||||
<td class="item-genre">喜剧</td>
|
<td class="item-duration">175</td>
|
||||||
<td class="item-actors-count">4</td>
|
<td class="item-genre">喜剧</td>
|
||||||
</tr>
|
<td class="item-actors-count">4</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">7</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">忠犬八公的故事</td>
|
<td class="item-id">7</td>
|
||||||
<td class="item-director">Lasse Hallström</td>
|
<td class="item-title">忠犬八公的故事</td>
|
||||||
<td class="item-year">2004</td>
|
<td class="item-director">Lasse Hallström</td>
|
||||||
<td class="item-rating">8.2</td>
|
<td class="item-year">2004</td>
|
||||||
<td class="item-duration">91</td>
|
<td class="item-rating">8.2</td>
|
||||||
<td class="item-genre">动画</td>
|
<td class="item-duration">91</td>
|
||||||
<td class="item-actors-count">3</td>
|
<td class="item-genre">动画</td>
|
||||||
</tr>
|
<td class="item-actors-count">3</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">8</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">三傻大闹宝莱坞</td>
|
<td class="item-id">8</td>
|
||||||
<td class="item-director">Rajkumar Hirani</td>
|
<td class="item-title">三傻大闹宝莱坞</td>
|
||||||
<td class="item-year">2011</td>
|
<td class="item-director">Rajkumar Hirani</td>
|
||||||
<td class="item-rating">6.3</td>
|
<td class="item-year">2011</td>
|
||||||
<td class="item-duration">175</td>
|
<td class="item-rating">6.3</td>
|
||||||
<td class="item-genre">冒险</td>
|
<td class="item-duration">175</td>
|
||||||
<td class="item-actors-count">3</td>
|
<td class="item-genre">冒险</td>
|
||||||
</tr>
|
<td class="item-actors-count">3</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">9</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">阿甘正传</td>
|
<td class="item-id">9</td>
|
||||||
<td class="item-director">Christophe Barratier</td>
|
<td class="item-title">阿甘正传</td>
|
||||||
<td class="item-year">2022</td>
|
<td class="item-director">Christophe Barratier</td>
|
||||||
<td class="item-rating">7.9</td>
|
<td class="item-year">2022</td>
|
||||||
<td class="item-duration">107</td>
|
<td class="item-rating">7.9</td>
|
||||||
<td class="item-genre">动画</td>
|
<td class="item-duration">107</td>
|
||||||
<td class="item-actors-count">4</td>
|
<td class="item-genre">动画</td>
|
||||||
</tr>
|
<td class="item-actors-count">4</td>
|
||||||
|
</tr>
|
||||||
<tr class="item-row">
|
|
||||||
<td class="item-id">10</td>
|
<tr class="item-row">
|
||||||
<td class="item-title">千与千寻</td>
|
<td class="item-id">10</td>
|
||||||
<td class="item-director">Christopher Nolan</td>
|
<td class="item-title">千与千寻</td>
|
||||||
<td class="item-year">1993</td>
|
<td class="item-director">Christopher Nolan</td>
|
||||||
<td class="item-rating">7.2</td>
|
<td class="item-year">1993</td>
|
||||||
<td class="item-duration">129</td>
|
<td class="item-rating">7.2</td>
|
||||||
<td class="item-genre">悬疑</td>
|
<td class="item-duration">129</td>
|
||||||
<td class="item-actors-count">3</td>
|
<td class="item-genre">悬疑</td>
|
||||||
</tr>
|
<td class="item-actors-count">3</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
|
||||||
</table>
|
</tbody>
|
||||||
</body>
|
</table>
|
||||||
|
</body>
|
||||||
|
=======
|
||||||
|
<!-- exam_fingerprint: B-20260705-9162 -->
|
||||||
|
<!-- server_time: 2026-07-05 21:45:58 -->
|
||||||
|
<!-- exam_paper: B -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>电影列表</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: "Microsoft YaHei", sans-serif; margin: 20px; background: #f5f5f5; }
|
||||||
|
h1 { color: #c0392b; }
|
||||||
|
.meta { color: #999; font-size: 12px; margin-bottom: 15px; }
|
||||||
|
.meta code { background: #e9ecef; padding: 2px 6px; border-radius: 3px; }
|
||||||
|
table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||||
|
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
|
||||||
|
th { background: #c0392b; color: white; }
|
||||||
|
tr:hover { background: #fef5f4; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>电影列表</h1>
|
||||||
|
<p class="meta">数据编号:<code>B-20260705-9162</code></p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>编号</th>
|
||||||
|
<th>电影名</th>
|
||||||
|
<th>导演</th>
|
||||||
|
<th>上映年份</th>
|
||||||
|
<th>评分</th>
|
||||||
|
<th>时长(分钟)</th>
|
||||||
|
<th>类型</th>
|
||||||
|
<th>主演数</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">1</td>
|
||||||
|
<td class="item-title">放牛班的春天</td>
|
||||||
|
<td class="item-director">Frank Darabont</td>
|
||||||
|
<td class="item-year">2007</td>
|
||||||
|
<td class="item-rating">8.9</td>
|
||||||
|
<td class="item-duration">155</td>
|
||||||
|
<td class="item-genre">悬疑</td>
|
||||||
|
<td class="item-actors-count">5</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">2</td>
|
||||||
|
<td class="item-title">霸王别姬</td>
|
||||||
|
<td class="item-director">陈凯歌</td>
|
||||||
|
<td class="item-year">2018</td>
|
||||||
|
<td class="item-rating">6.6</td>
|
||||||
|
<td class="item-duration">143</td>
|
||||||
|
<td class="item-genre">剧情</td>
|
||||||
|
<td class="item-actors-count">4</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">3</td>
|
||||||
|
<td class="item-title">星际穿越</td>
|
||||||
|
<td class="item-director">Robert Zemeckis</td>
|
||||||
|
<td class="item-year">2018</td>
|
||||||
|
<td class="item-rating">8.4</td>
|
||||||
|
<td class="item-duration">165</td>
|
||||||
|
<td class="item-genre">悬疑</td>
|
||||||
|
<td class="item-actors-count">5</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">4</td>
|
||||||
|
<td class="item-title">肖申克的救赎</td>
|
||||||
|
<td class="item-director">James Cameron</td>
|
||||||
|
<td class="item-year">2008</td>
|
||||||
|
<td class="item-rating">8.6</td>
|
||||||
|
<td class="item-duration">124</td>
|
||||||
|
<td class="item-genre">剧情</td>
|
||||||
|
<td class="item-actors-count">5</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">5</td>
|
||||||
|
<td class="item-title">盗梦空间</td>
|
||||||
|
<td class="item-director">宫崎骏</td>
|
||||||
|
<td class="item-year">1993</td>
|
||||||
|
<td class="item-rating">7.8</td>
|
||||||
|
<td class="item-duration">90</td>
|
||||||
|
<td class="item-genre">爱情</td>
|
||||||
|
<td class="item-actors-count">2</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">6</td>
|
||||||
|
<td class="item-title">泰坦尼克号</td>
|
||||||
|
<td class="item-director">Christopher Nolan</td>
|
||||||
|
<td class="item-year">2001</td>
|
||||||
|
<td class="item-rating">6.7</td>
|
||||||
|
<td class="item-duration">175</td>
|
||||||
|
<td class="item-genre">喜剧</td>
|
||||||
|
<td class="item-actors-count">4</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">7</td>
|
||||||
|
<td class="item-title">忠犬八公的故事</td>
|
||||||
|
<td class="item-director">Lasse Hallström</td>
|
||||||
|
<td class="item-year">2004</td>
|
||||||
|
<td class="item-rating">8.2</td>
|
||||||
|
<td class="item-duration">91</td>
|
||||||
|
<td class="item-genre">动画</td>
|
||||||
|
<td class="item-actors-count">3</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">8</td>
|
||||||
|
<td class="item-title">三傻大闹宝莱坞</td>
|
||||||
|
<td class="item-director">Rajkumar Hirani</td>
|
||||||
|
<td class="item-year">2011</td>
|
||||||
|
<td class="item-rating">6.3</td>
|
||||||
|
<td class="item-duration">175</td>
|
||||||
|
<td class="item-genre">冒险</td>
|
||||||
|
<td class="item-actors-count">3</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">9</td>
|
||||||
|
<td class="item-title">阿甘正传</td>
|
||||||
|
<td class="item-director">Christophe Barratier</td>
|
||||||
|
<td class="item-year">2022</td>
|
||||||
|
<td class="item-rating">7.9</td>
|
||||||
|
<td class="item-duration">107</td>
|
||||||
|
<td class="item-genre">动画</td>
|
||||||
|
<td class="item-actors-count">4</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="item-row">
|
||||||
|
<td class="item-id">10</td>
|
||||||
|
<td class="item-title">千与千寻</td>
|
||||||
|
<td class="item-director">Christopher Nolan</td>
|
||||||
|
<td class="item-year">1993</td>
|
||||||
|
<td class="item-rating">7.2</td>
|
||||||
|
<td class="item-duration">129</td>
|
||||||
|
<td class="item-genre">悬疑</td>
|
||||||
|
<td class="item-actors-count">3</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
>>>>>>> a48acdad2552a0dd4f3db2345ad8092003820c28
|
||||||
</html>
|
</html>
|
||||||
@@ -1,105 +1,212 @@
|
|||||||
{
|
<<<<<<< HEAD
|
||||||
"data_code": "B-20260705-9162",
|
{
|
||||||
"movies": [
|
"data_code": "B-20260705-9162",
|
||||||
{
|
"movies": [
|
||||||
"id": 1,
|
{
|
||||||
"title": "放牛班的春天",
|
"id": 1,
|
||||||
"director": "Frank Darabont",
|
"title": "放牛班的春天",
|
||||||
"year": 2007,
|
"director": "Frank Darabont",
|
||||||
"rating": 8.9,
|
"year": 2007,
|
||||||
"duration": 155,
|
"rating": 8.9,
|
||||||
"genre": "悬疑",
|
"duration": 155,
|
||||||
"actors_count": 5
|
"genre": "悬疑",
|
||||||
},
|
"actors_count": 5
|
||||||
{
|
},
|
||||||
"id": 2,
|
{
|
||||||
"title": "霸王别姬",
|
"id": 2,
|
||||||
"director": "陈凯歌",
|
"title": "霸王别姬",
|
||||||
"year": 2018,
|
"director": "陈凯歌",
|
||||||
"rating": 6.6,
|
"year": 2018,
|
||||||
"duration": 143,
|
"rating": 6.6,
|
||||||
"genre": "剧情",
|
"duration": 143,
|
||||||
"actors_count": 4
|
"genre": "剧情",
|
||||||
},
|
"actors_count": 4
|
||||||
{
|
},
|
||||||
"id": 3,
|
{
|
||||||
"title": "星际穿越",
|
"id": 3,
|
||||||
"director": "Robert Zemeckis",
|
"title": "星际穿越",
|
||||||
"year": 2018,
|
"director": "Robert Zemeckis",
|
||||||
"rating": 8.4,
|
"year": 2018,
|
||||||
"duration": 165,
|
"rating": 8.4,
|
||||||
"genre": "悬疑",
|
"duration": 165,
|
||||||
"actors_count": 5
|
"genre": "悬疑",
|
||||||
},
|
"actors_count": 5
|
||||||
{
|
},
|
||||||
"id": 4,
|
{
|
||||||
"title": "肖申克的救赎",
|
"id": 4,
|
||||||
"director": "James Cameron",
|
"title": "肖申克的救赎",
|
||||||
"year": 2008,
|
"director": "James Cameron",
|
||||||
"rating": 8.6,
|
"year": 2008,
|
||||||
"duration": 124,
|
"rating": 8.6,
|
||||||
"genre": "剧情",
|
"duration": 124,
|
||||||
"actors_count": 5
|
"genre": "剧情",
|
||||||
},
|
"actors_count": 5
|
||||||
{
|
},
|
||||||
"id": 5,
|
{
|
||||||
"title": "盗梦空间",
|
"id": 5,
|
||||||
"director": "宫崎骏",
|
"title": "盗梦空间",
|
||||||
"year": 1993,
|
"director": "宫崎骏",
|
||||||
"rating": 7.8,
|
"year": 1993,
|
||||||
"duration": 90,
|
"rating": 7.8,
|
||||||
"genre": "爱情",
|
"duration": 90,
|
||||||
"actors_count": 2
|
"genre": "爱情",
|
||||||
},
|
"actors_count": 2
|
||||||
{
|
},
|
||||||
"id": 6,
|
{
|
||||||
"title": "泰坦尼克号",
|
"id": 6,
|
||||||
"director": "Christopher Nolan",
|
"title": "泰坦尼克号",
|
||||||
"year": 2001,
|
"director": "Christopher Nolan",
|
||||||
"rating": 6.7,
|
"year": 2001,
|
||||||
"duration": 175,
|
"rating": 6.7,
|
||||||
"genre": "喜剧",
|
"duration": 175,
|
||||||
"actors_count": 4
|
"genre": "喜剧",
|
||||||
},
|
"actors_count": 4
|
||||||
{
|
},
|
||||||
"id": 7,
|
{
|
||||||
"title": "忠犬八公的故事",
|
"id": 7,
|
||||||
"director": "Lasse Hallström",
|
"title": "忠犬八公的故事",
|
||||||
"year": 2004,
|
"director": "Lasse Hallström",
|
||||||
"rating": 8.2,
|
"year": 2004,
|
||||||
"duration": 91,
|
"rating": 8.2,
|
||||||
"genre": "动画",
|
"duration": 91,
|
||||||
"actors_count": 3
|
"genre": "动画",
|
||||||
},
|
"actors_count": 3
|
||||||
{
|
},
|
||||||
"id": 8,
|
{
|
||||||
"title": "三傻大闹宝莱坞",
|
"id": 8,
|
||||||
"director": "Rajkumar Hirani",
|
"title": "三傻大闹宝莱坞",
|
||||||
"year": 2011,
|
"director": "Rajkumar Hirani",
|
||||||
"rating": 6.3,
|
"year": 2011,
|
||||||
"duration": 175,
|
"rating": 6.3,
|
||||||
"genre": "冒险",
|
"duration": 175,
|
||||||
"actors_count": 3
|
"genre": "冒险",
|
||||||
},
|
"actors_count": 3
|
||||||
{
|
},
|
||||||
"id": 9,
|
{
|
||||||
"title": "阿甘正传",
|
"id": 9,
|
||||||
"director": "Christophe Barratier",
|
"title": "阿甘正传",
|
||||||
"year": 2022,
|
"director": "Christophe Barratier",
|
||||||
"rating": 7.9,
|
"year": 2022,
|
||||||
"duration": 107,
|
"rating": 7.9,
|
||||||
"genre": "动画",
|
"duration": 107,
|
||||||
"actors_count": 4
|
"genre": "动画",
|
||||||
},
|
"actors_count": 4
|
||||||
{
|
},
|
||||||
"id": 10,
|
{
|
||||||
"title": "千与千寻",
|
"id": 10,
|
||||||
"director": "Christopher Nolan",
|
"title": "千与千寻",
|
||||||
"year": 1993,
|
"director": "Christopher Nolan",
|
||||||
"rating": 7.2,
|
"year": 1993,
|
||||||
"duration": 129,
|
"rating": 7.2,
|
||||||
"genre": "悬疑",
|
"duration": 129,
|
||||||
"actors_count": 3
|
"genre": "悬疑",
|
||||||
}
|
"actors_count": 3
|
||||||
]
|
}
|
||||||
|
]
|
||||||
|
=======
|
||||||
|
{
|
||||||
|
"data_code": "B-20260705-9162",
|
||||||
|
"movies": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"title": "放牛班的春天",
|
||||||
|
"director": "Frank Darabont",
|
||||||
|
"year": 2007,
|
||||||
|
"rating": 8.9,
|
||||||
|
"duration": 155,
|
||||||
|
"genre": "悬疑",
|
||||||
|
"actors_count": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"title": "霸王别姬",
|
||||||
|
"director": "陈凯歌",
|
||||||
|
"year": 2018,
|
||||||
|
"rating": 6.6,
|
||||||
|
"duration": 143,
|
||||||
|
"genre": "剧情",
|
||||||
|
"actors_count": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"title": "星际穿越",
|
||||||
|
"director": "Robert Zemeckis",
|
||||||
|
"year": 2018,
|
||||||
|
"rating": 8.4,
|
||||||
|
"duration": 165,
|
||||||
|
"genre": "悬疑",
|
||||||
|
"actors_count": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"title": "肖申克的救赎",
|
||||||
|
"director": "James Cameron",
|
||||||
|
"year": 2008,
|
||||||
|
"rating": 8.6,
|
||||||
|
"duration": 124,
|
||||||
|
"genre": "剧情",
|
||||||
|
"actors_count": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"title": "盗梦空间",
|
||||||
|
"director": "宫崎骏",
|
||||||
|
"year": 1993,
|
||||||
|
"rating": 7.8,
|
||||||
|
"duration": 90,
|
||||||
|
"genre": "爱情",
|
||||||
|
"actors_count": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"title": "泰坦尼克号",
|
||||||
|
"director": "Christopher Nolan",
|
||||||
|
"year": 2001,
|
||||||
|
"rating": 6.7,
|
||||||
|
"duration": 175,
|
||||||
|
"genre": "喜剧",
|
||||||
|
"actors_count": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"title": "忠犬八公的故事",
|
||||||
|
"director": "Lasse Hallström",
|
||||||
|
"year": 2004,
|
||||||
|
"rating": 8.2,
|
||||||
|
"duration": 91,
|
||||||
|
"genre": "动画",
|
||||||
|
"actors_count": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"title": "三傻大闹宝莱坞",
|
||||||
|
"director": "Rajkumar Hirani",
|
||||||
|
"year": 2011,
|
||||||
|
"rating": 6.3,
|
||||||
|
"duration": 175,
|
||||||
|
"genre": "冒险",
|
||||||
|
"actors_count": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"title": "阿甘正传",
|
||||||
|
"director": "Christophe Barratier",
|
||||||
|
"year": 2022,
|
||||||
|
"rating": 7.9,
|
||||||
|
"duration": 107,
|
||||||
|
"genre": "动画",
|
||||||
|
"actors_count": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"title": "千与千寻",
|
||||||
|
"director": "Christopher Nolan",
|
||||||
|
"year": 1993,
|
||||||
|
"rating": 7.2,
|
||||||
|
"duration": 129,
|
||||||
|
"genre": "悬疑",
|
||||||
|
"actors_count": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
>>>>>>> a48acdad2552a0dd4f3db2345ad8092003820c28
|
||||||
}
|
}
|
||||||
27
q2_1_crawler/q3_2_takeout_reviews.json
Normal file
27
q2_1_crawler/q3_2_takeout_reviews.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"text": "外卖小哥送得超快,餐盒还是热的,炸鸡酥脆多汁,酸辣粉也很正宗,分量足,五星好评!",
|
||||||
|
"sentiment": "正面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"text": "等了一个半小时才送到,汤全洒了,面坨成一坨,联系客服也不回,太让人失望了。",
|
||||||
|
"sentiment": "负面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"text": "奶茶是用料很扎实的现煮茶,珍珠Q弹有嚼劲,配送员态度也好,下次还会再点。",
|
||||||
|
"sentiment": "正面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"text": "配送速度一般,但披萨味道不错,芝士拉丝效果好,性价比高,值得推荐。",
|
||||||
|
"sentiment": "正面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"text": "点的麻辣烫食材不新鲜,有股怪味,吃完拉肚子,商家推卸责任,再也不点了。",
|
||||||
|
"sentiment": "负面"
|
||||||
|
}
|
||||||
|
]
|
||||||
27
q3/q3_2/q3_2_takeout_reviews.json
Normal file
27
q3/q3_2/q3_2_takeout_reviews.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"text": "外卖小哥送得超快,餐盒还是热的,炸鸡酥脆多汁,酸辣粉也很正宗,分量足,五星好评!",
|
||||||
|
"sentiment": "正面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"text": "等了一个半小时才送到,汤全洒了,面坨成一坨,联系客服也不回,太让人失望了。",
|
||||||
|
"sentiment": "负面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"text": "奶茶是用料很扎实的现煮茶,珍珠Q弹有嚼劲,配送员态度也好,下次还会再点。",
|
||||||
|
"sentiment": "正面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"text": "配送速度一般,但披萨味道不错,芝士拉丝效果好,性价比高,值得推荐。",
|
||||||
|
"sentiment": "正面"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"text": "点的麻辣烫食材不新鲜,有股怪味,吃完拉肚子,商家推卸责任,再也不点了。",
|
||||||
|
"sentiment": "负面"
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user