python利用字典统计词频的两种方式 1、自带collections库 >>> import collections >>> s = 'collections' >>> collections.Counter(s) Counter({ 'c': 2, 'o'