I have a question about dictionary handling in Python.
I wonder how to compare the dictionary with the list of words.
[example of my input]
text = ['fall', 'big', 'pocket', 'layer', 'park', ...]
mylist = ['spring', 'summer', 'fall', 'winter', 'school', ...]
[make dictionary code]
lst_dic = {mylist : 0 for mylist in mylist }
lst_dic
I want to know how many words matching in mylist
from text
.
[fail code]
lst_dic = {}
for w in mylist:
if w in text_1_1:
lst_dic[w] += 1
else:
lst_dic[w] = 0
As a result, I want to know dictionary key and value.
Like this:
{ 'spring':0,
'summer':3,
'fall':1,
'winter':0,
...
}
Then, I want to extract more than 10 count value of attributes.
Please take a look at this issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…