Python- Count each letter in a list of words

后端 未结 7 1523
心在旅途
心在旅途 2021-01-16 05:46

So I have a list of words `wordList = list().\' Right now, I am counting each letter in each of the words throughout the whole list using this code

cnt = C         


        
7条回答
  •  北荒
    北荒 (楼主)
    2021-01-16 06:29

    import collections
    
    cnt = collections.Counter('happy harpy hasty').keys()
    
    cnt = list(cnt)
    
    print(cnt)
    

提交回复
热议问题