Week5

利用 Python3 找出缺席名單

f1 = open('696.txt', 'r')

f2 = open('878.txt', 'r')

#讀取 696.txt(點名名單) & 878.txt(修課名單) 進行比對

s1 = set(f1)

s2 = set(f2)

#將兩者集合

print ('二乙缺席名單:')

print (list(s1.symmetric_difference(s2)))

顯示結果如下:

二乙缺席名單:

['40523224\n', '40523232\n', '40523212\n', '40523234\n', '40523227\n', '40523231\n', '40523217\n', '40523222\n']

results matching ""

    No results matching ""