ranlan's recent timeline updates
ranlan

ranlan

V2EX member #451398, joined on 2019-11-06 11:34:18 +08:00
ranlan's recent replies
Nov 6, 2019
Replied to a topic by css3 Python 两个 list 怎么比较后求出多出来的那值?
不还意思我理解错了
应该是这样
a1 = [x['key'] for x in a]

c = [i for i in b if i['key'] not in a1]
Nov 6, 2019
Replied to a topic by 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]
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2802 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 07:33 · PVG 15:33 · LAX 00:33 · JFK 03:33
♥ Do have faith in what you're doing.