>>> doc_title = 'nihao'
>>> url = 'www.nihao.com'
>>> td_matrix = {}
>>> td_matrix[(doc_title, url)] = {}
>>> td_matrix
{('nihao', 'www.nihao.com'): {}}
>>> td_matrix[(doc_title, url)]['good'] = 1
>>> td_matrix
{('nihao', 'www.nihao.com'): {'good': 1}}
>>> td_matrix[(doc_title, url)] = {'good': 1}
>>> td_matrix
{('nihao', 'www.nihao.com'): {'good': 1}}
Python 对字典元素的赋值 (字典key和value均为组合类型)
最新推荐文章于 2024-01-19 17:32:24 发布