编写代码,统计下列字符串中Python出现的次数,并将Python及次数存储在字典中,打印实现以下效果图
str_1 = "I like Python. But which Python version should I use? Python 2 or Python 3?"
效果图:{'Python’: 4}
# conding:utf-8
str_1 = 'I like Python. But which Python version should I use? Python 2 or Python 3 ?'
new_str = str_1.count("Python")
new_list = [new_str]
new_dict = {
'Python': new_str
}
print(new_dict)