【发布时间】:2015-08-10 17:17:42
【问题描述】:
给定两个长度相同的列表:
List1 = ['a','b','c','d','b','a','b','c']
List2 = ['1','2','3','4','5','6','7','8']
我想将一个字典输出为:
dic = {'a':['1','6'], 'b':['2','5','7'], 'c':['3','8'], 'd':['4']}
如何在 Python 中实现它?谢谢!
【问题讨论】:
-
您自己尝试过解决方案吗?
标签: python list dictionary count