- 论坛徽章:
- 3
|
回复 6# love_shift
- #coding=utf-8
- from collections import Counter
- import string
- s = 'adfeife df吓到 erqapfdanfeiurepoefu832k'
- n = [ x for x in s if x in string.letters ]
- for k,v in Counter(n).iteritems():
- print(k,v)
复制代码 Traceback (most recent call last):
File "E:\pythonspace\p\src\t2.py", line 5, in <module>
n = [ x for x in s if x in string.letters ]
File "E:\pythonspace\p\src\t2.py", line 5, in <listcomp>
n = [ x for x in s if x in string.letters ]
AttributeError: 'module' object has no attribute 'letters'
|
|