How to print dict in separate line?

前端 未结 6 1769
猫巷女王i
猫巷女王i 2020-12-06 14:20
import re
sums = dict()
fh= open(\'wordcount.txt\',\'r\')
for line in fh:
    words = [word.lower() for word in re.findall(r\'\\b\\w+\\b\', line)]
    for word in (w         


        
6条回答
  •  天命终不由人
    2020-12-06 15:03

    >>> from pprint import pprint
    >>> pprint(sums)
    {'air': 2,
     'and': 1,
     'at': 3,
     'be': 1,
     'body': 1,
     ....., # and so on...
     'you': 2}
    

提交回复
热议问题