python: check if substring is in tuple of strings
<p>Which is the most elegant way to check if there is an occurrence of several substrings in a tuple of strings?</p>

<pre><code>tuple = ('first-second', 'second-third', 'third-first') 
substr1 = 'first' 
substr2 = 'second' 
substr3 = 'third'
#if substr1 in tuple and substr2 in tuple and substr3 in tuple:
#    should return True
</code></pre>

<p>You need to iterate over the tuple for each of the substrings, so using <code>any</code> and <code>all</code>:</p>

<pre><code>all(any(substr in s for s in data) for substr in ['first', 'second', 'third'])
</code></pre>

python substring tuples