t1 = "a", t2 = t1*2 if("a" in t2): print "Contains a" if("b" in t2): print "Contains b"