1
lisztli 2012-07-06 00:03:47 +08:00 2
sa, sb = set(a), set(b)
return list(sa - sb) |
2
sethverlo OP @lisztli 不对啊⋯⋯咦你不是饭否 api 的那个维护者么。。。
>>> a = "<id>123</id><id>345</id><id>456</id>" >>> b = "<id>123</id><id>333</id>" >>> sa, sb = set(a), set(b) >>> list(sa - sb) ['5', '4', '6'] >>> a = ['123', '456', '567'] >>> b = ['123,', '555'] >>> sa, sb = set(a), set(b) >>> list(sa - sb) ['123', '456', '567'] |
4
lisztli 2012-07-06 00:19:02 +08:00 1
>>> a = ['123', '456', '567']
>>> b = ['123,', '555'] 再看一遍代码…… |
5
lisztli 2012-07-06 00:22:00 +08:00 1
|
10
fanzeyi 2012-07-06 00:43:26 +08:00
a = [1,2,3,4,5]
b = [5,6,7,8] c = [xx for xx in b if xx not in a] |
15
sethverlo OP @fanzeyi 先试试呗。不够用了再说⋯我们那个 vps 我一直蛋疼那速度。。。下一个再不换 linode 我就剁 jj 去。。。
|
17
ch_linghu 2012-07-12 10:51:10 +08:00 1
try difflib
http://docs.python.org/library/difflib.html |