From c8a635dab3a83de67fef339552f9bb5c908bf3b5 Mon Sep 17 00:00:00 2001 From: TylerJackk Date: Fri, 2 Aug 2019 14:23:39 +0800 Subject: [PATCH] use most_common(n) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c603b8f..21031b0 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,8 @@ value = .pop(key) # Removes item from dictionary. >>> colors = ['red', 'blue', 'yellow', 'blue', 'red', 'blue'] >>> counter = Counter(colors) Counter({'blue': 3, 'red': 2, 'yellow': 1}) ->>> counter.most_common()[0] -('blue', 3) +>>> counter.most_common(1) +[('blue', 3)] ```