我想在字典中添加数字,累积,所以它会添加字典的键。
x = ' '
dict = {}
list = []
while x != '':
x = raw_input('Enter line:')
p = x.split(' ')
if x != '':
list.append(p)
result = sum(list, [])
result = result
num = []
for a in result:
for n in dict:
p = a.count(a)
l = a
if n == l:
l += l
dict[a] = p
print dict
raw_input('')
我希望“dict”由输入中的单词和输入的次数组成。谢谢