And*_*ark 18

用途any():

if any(s in some_string for s in example):
    # at least one of the elements is a substring of some_string
Run Code Online (Sandbox Code Playgroud)

  • 这看起来像是最"Pythonic"的做法. (2认同)