用for循环
def word_count(s):
split_list = s.split()
dict_result = {
}
#遍历列表,判断每个词是否在字典的键中,如果存在则键值加一,不存在设为1
for word in split_list:
if word not in dict_result
用for循环
def word_count(s):
split_list = s.split()
dict_result = {
}
#遍历列表,判断每个词是否在字典的键中,如果存在则键值加一,不存在设为1
for word in split_list:
if word not in dict_result