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():