Python统计一个字符串中的每一个字符出现了多少次
from collections import Counter li = "j\xa0\xa0\xa0ddd\xa0cccc" s = Counter(li) print(s) # s是个字典 Counter({'\xa0': 4, 'c': 4, 'd': 3, 'j': 1}) print(s)['\xa0'] # 4