class Counter(dict): pass c = Counter() for ch in 'programming': try: c[ch] except: c[ch]=0 c[ch] = c[ch] + 1
本来想在Counter里面加getitem去操作,最后无限递归了,先这样。
Sign in to make a reply
onion_4
class Counter(dict): pass c = Counter() for ch in 'programming': try: c[ch] except: c[ch]=0 c[ch] = c[ch] + 1
本来想在Counter里面加getitem去操作,最后无限递归了,先这样。