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

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

10
2-7.py
View File

@ -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