01 Python增加元素,不像其他语言使用现实的操作接口,只需要dict[1]=3,如果字典中不存在1,则直接新增元素键值对(1,3),如果存在则替换键1为3. if key in dict:判断出key是否在dict字典中. 统计元素出现的次数: def word_count(nums): dict={} for it in nums: if it not in dict: dict[it] = 1 else: dict[it] += 1 return dict print(word_cou…