python相关问题求解

img


input:1547888996545112
{'1': 2, '5': 2, '4': 2, '7': 1, '8': 2, '9': 2, '6': 1, '2': 1}
程序不能正确计数,求解

大概写了一下,大概是这种感觉
你判断字符串是否在字典内的语句似乎有些问题
有帮助望采纳

input_words = input()
word_count = {}
for character in input_words:
    if character not in word_count.keys():
        word_count[character] = input_words.count(character)
print(word_count)