【发布时间】:2019-02-14 10:07:22
【问题描述】:
我正在尝试从我的列表中找到与字典值中的列表相匹配的匹配项
例如字典包含
dict = {"test1": [1, 2, 3, 4],
"test2": [2, 2, 3, 4],
"test3": [1, 2, 4, 5],
"test4": [6, 2, 3, 4],
"test5": [7, 2, 3, 4]}
以及我需要为 if 找到匹配项的数据
answer = [6,2,3,4]
我正在尝试提取答案输入的第一个值必须不同而其余相同的任何测试,例如
[(this is different), 2,3,4]
那么最后我想记录test1、test2和test5。
【问题讨论】:
-
你能分享你写的没有产生你想要的输出的代码吗?
-
"所以最后我想记录 test1、test2 和 test 5。" - 你所说的“成为”是什么意思录”?我不清楚你想要达到什么目的。
标签: python python-3.x dictionary