On 22/08/12 03:57, mingqiang hu wrote:
> can I use just one statement to figure out if substring “a” ,"b" "c"
> are in string "adfbdfc" ? not use the statement like
> ("a" in "adfbdfc") or ( "b" in "adfbdfc") or ("c" in "adfbdfc" )
> ,because if I have lots of substring, this could sucks

subs = ['a', 'b', 'c']
string = 'abcdef'

def all_in(string, substrings):
    return all(map(string.__contains__, subs))
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to