标签:UNC intersect lin str enc adl union plain inter
Python 求两个文本文件以行为单位的交集 并集 差集
s1
=
set
(
open
(
‘a.txt‘
,
‘r‘
).readlines())
s2
=
set
(
open
(
‘b.txt‘
,
‘r‘
).readlines())
print
‘ins: %s‘
%
(s1.intersection(s2))
print
‘uni: %s‘
%
(s1.union(s2))
print
‘dif: %s‘
%
(s1.difference(s2).union(s2.difference(s1)))
标签:UNC intersect lin str enc adl union plain inter
原文地址:https://www.cnblogs.com/medik/p/11040620.html