python - Nested dict comprehension -
in following code,
[{word: score_tweet(tweet) word in tweet} tweet in tweets]
i getting list of dicts:
[{u'soad': 0.0, u'<3': 0.0}, {u'outros': 0.0, u'acredita': 0.0}]
i obtain 1 flat dict like:
{u'soad': 0.0, u'<3': 0.0, u'outros': 0.0, u'acredita': 0.0}
how should change code? note: using python 2.7.
{word: score_tweet(tweet) tweet in tweets word in tweet}
Comments
Post a Comment