diff --git a/2-7.py b/2-7.py index 0591183..cc27e9a 100644 --- a/2-7.py +++ b/2-7.py @@ -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()