如果我有2个列表:
fruits = ["apple","apple","oranges","watermelon","apple"]
val = ["a","b","c","d","e"]
val的每个索引对应于水果的索引
因此,如果我想要具有以下内容的字典:
dict
{
"apple" : ["a","b","e"],
"oranges": ["c"],
"watermelon": ["d"]
}
最简单的方法是什么?
白衣非少年
隔江千里
相关分类