【发布时间】:2020-02-06 07:35:10
【问题描述】:
鉴于这两个列表:
lst_1=['Apple', 'pie', 'is', 'the', 'most', 'delicious'] #list 1
lst_2=['It', 'is', 'Americas', 'best'] #list 2
如何将它们放入字典中,以便它告诉我它来自哪个列表(1 或 2),如下所示:
d['Apple'] = [1] #"Apple "is in list 1
d['pie']=[1] #"pie" is in list 1
d['is']=[1,2] #"is" is in list 1 and 2
d['It']=[2] # "It" is in list 2
【问题讨论】:
标签: python python-3.x list function dictionary