像这个dict如何初始化呢
def his(s):
d = dict()
for c in s:
d[c] += d.get(c,1)
return d
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
Python 中的
defaultdict和Counter可以对应 C++ 中的multidict( 楼主你的代码就是一个典型的多路字典的需求 )