From ef127d8ee999582f64be8ff958672ad45208eec8 Mon Sep 17 00:00:00 2001 From: zj3D Date: Wed, 13 Mar 2024 22:25:14 +0800 Subject: [PATCH] =?UTF-8?q?print=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 基本结构/享元模式/tf-38.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/基本结构/享元模式/tf-38.py b/基本结构/享元模式/tf-38.py index eab1e50..79b8c7d 100644 --- a/基本结构/享元模式/tf-38.py +++ b/基本结构/享元模式/tf-38.py @@ -21,8 +21,7 @@ class ConcreteWordFrequencyController(WordFrequencyController): self.word_freq = get_frequencies(self.word_list) self.word_freq = sort_dict(self.word_freq) def print_word_freqs(self, number): - for (w, c) in self.word_freq[:number]: - print(w, '-', c) + print_word_freqs( self.word_freq,number) #定义享元工厂 class WordFrequencyControllerFactory(): -- 2.34.1