play with set (new python 2.4 module)
a = set("ABC") b = set("CDE") print "A:",a print "B:",b print "Intersection:\t",a & b print "Union:\t\t",a | b print "Diff a-b:\t\t",a - b print "Diff b-a:\t\t",b - a print "Exclusive:\t\t",a ^ b
DZone Snippets > manatlan > set
12389 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
manatlan http://manatlan.online.fr
a = set("ABC") b = set("CDE") print "A:",a print "B:",b print "Intersection:\t",a & b print "Union:\t\t",a | b print "Diff a-b:\t\t",a - b print "Diff b-a:\t\t",b - a print "Exclusive:\t\t",a ^ b