求两个列表的差集 >>> a = [1,2,3] >>> b=[1,2] >>> #################################### >>> #两个列表的差集 >>> ret = [] >>> for i in a: if i not in b: ret.append(i) >>> ret [3] >>> #两个列表的差集2 >>…
使用comm命令 假设两个文件FILE1和FILE2用集合A和B表示,FILE1内容如下: a b c e d a FILE2内容如下: c d a c 基本上有两个方法,一个是comm命令,一个是grep命令.分别介绍如下: comm命令 , Compare sorted files FILE1 and FILE2 line by line. With no options, produce three-column output. Column one contains lines un…