Comparing lists

ajikoe at gmail.com ajikoe at gmail.com
Mon Oct 10 03:51:39 EDT 2005


try to use set.
    L1 = [1,1,2,3,4]
    L2 = [1,3, 99]
    A = set(L1)
    B = set(L2)

    X = A-B
    print X

    Y = B-A
    print Y

    Z = A | B
    print Z
    
Cheers,
pujo




More information about the Python-list mailing list