refactor(2-7.py): 移除不必要的代码并简化获取最多 404 错误记录的五天的逻辑

- 删除了不必要的输出前五天及其 404 错误记录的代码
- 删除了不必要的停止 Spark 代码
- 简化了获取最多 404 错误记录的五天的逻辑
This commit is contained in:
fly6516 2025-04-14 03:55:54 +08:00
parent d67642da65
commit 4a0b9f0735

10
2-7.py
View File

@ -57,4 +57,12 @@ if __name__ == "__main__":
) )
# 获取最多的五天 # 获取最多的五天
top_5_days = errDateSorted top_5_days = errDateSorted.take(5)
# 输出前五天及其 404 错误记录
print("404 错误记录最多的五天及对应次数:")
for i, (day, count) in enumerate(top_5_days):
print("{} 天: {} => {} 次 404 错误".format(i + 1, day, count))
# 停止 Spark
sc.stop()