From d67642da65143ba93b64d7d75bc68335c1a24037 Mon Sep 17 00:00:00 2001 From: fly6516 Date: Mon, 14 Apr 2025 03:54:42 +0800 Subject: [PATCH] =?UTF-8?q?refactor(2-7.py):=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E4=BB=A3=E7=A0=81=E5=B9=B6=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E8=8E=B7=E5=8F=96=E6=9C=80=E5=A4=9A=20404=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E8=AE=B0=E5=BD=95=E7=9A=84=E4=BA=94=E5=A4=A9=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除了不必要的输出前五天及其 404 错误记录的代码 - 删除了不必要的停止 Spark 代码 - 简化了获取最多 404 错误记录的五天的逻辑 --- 2-7.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/2-7.py b/2-7.py index bf25422..0591183 100644 --- a/2-7.py +++ b/2-7.py @@ -57,12 +57,4 @@ if __name__ == "__main__": ) # 获取最多的五天 - top_5_days = errDateSorted.take(5) - - # 输出前五天及其 404 错误记录 - print("404 错误记录最多的五天及对应次数:") - for i, (day, count) in enumerate(top_5_days): - print(f"第 {i + 1} 天: {day} => {count} 次 404 错误") - - # 停止 Spark - sc.stop() + top_5_days = errDateSorted