Counter in Collections module Python

后端 未结 4 1685
耶瑟儿~
耶瑟儿~ 2020-11-29 10:17

I\'ve come across a really weird problem. I\'m trying to use Counter function in collections module. However, I keep getting the same error message

Attribut         


        
4条回答
  •  萌比男神i
    2020-11-29 11:16

    The Counter class was added to the module in Python 2.7. You are most likely using Python 2.6 or older. From the collections.Counter() documentation:

    New in version 2.7.

    On python 2.5 or 2.6, use this backport instead.

提交回复
热议问题