You could use a simple list comprehension here :
S = [x[0] for x in content_E.most_common(3)]
or, if you need to generate from E
, then:
S = [x[0] for x in E]
0
solved get most common keys from list
You could use a simple list comprehension here :
S = [x[0] for x in content_E.most_common(3)]
or, if you need to generate from E
, then:
S = [x[0] for x in E]
0
solved get most common keys from list