Settings are useful for this - see method isdisjoint():
Returns True if the collection has no elements in common with another. Sets do not intersect if and only if their intersection is an empty set.
new in version 2.6.
>>> a = "abcde"
>>> b = "ace"
>>> c = "xyz"
>>> set(a).isdisjoint(set(b))
False
>>> set(a).isdisjoint(set(c))
True
edit after comment
sets are still you friend. If I follow you better now, you want this (or something close to it):
, :
>>> a = set('abcde')
>>> b = set('ace')
>>> c = set('acx')
, :
>>> a.intersection(b) == b
True
- , :
>>> a.intersection(c) == c
False
, ?