From 0e328f76a1b0a5e9b5d9dae7de7ad26c8bd4f12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=A5=A0=E6=A5=A0?= <2509165032@student.example.com> Date: Tue, 23 Jun 2026 11:14:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20q4/q4=5F3b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- q4/q4_3b/q4_4.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 q4/q4_3b/q4_4.py diff --git a/q4/q4_3b/q4_4.py b/q4/q4_3b/q4_4.py new file mode 100644 index 0000000..7ad6650 --- /dev/null +++ b/q4/q4_3b/q4_4.py @@ -0,0 +1,12 @@ +import json +import matplotlib.pyplot as plt + +with open("../q2_1_crawler/movies.json","r",encoding="utf-8") as f: + data = json.load(f) +movies = data["movies"] + +dur = [i["duration"] for i in movies] +plt.hist(dur,edgecolor="black") +plt.xlabel("时长(分钟)") +plt.savefig("q4_3b_hist.png",dpi=150) +plt.close() \ No newline at end of file