ranlan 最近的时间轴更新
ranlan

ranlan

V2EX 第 451398 号会员,加入于 2019-11-06 11:34:18 +08:00
ranlan 最近回复了
2019-11-06 18:35:19 +08:00
回复了 css3 创建的主题 Python 两个 list 怎么比较后求出多出来的那值?
不还意思我理解错了
应该是这样
a1 = [x['key'] for x in a]

c = [i for i in b if i['key'] not in a1]
2019-11-06 18:14:17 +08:00
回复了 css3 创建的主题 Python 两个 list 怎么比较后求出多出来的那值?
b = [{'key': 5, 'value': 6}, {'key': 1, 'value': 2}, {'key': 3, 'value': 41} ]中应该是 {'key': 3, 'value': 41} 这个元素应该是 {'key': 3, 'value': 4}吧?
新手的解法
c = [i for i in b if i not in a]
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2585 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 14:23 · PVG 22:23 · LAX 07:23 · JFK 10:23
Developed with CodeLauncher
♥ Do have faith in what you're doing.