How to get files from directories in Python
<p>I have a list of directories (their absolute path). Each directory contains a certain number of files. Of these files I want to get two of them from each directory. The two files I want have some string pattern in their name, for the sake of this example the strings will be 'stringA', 'stringB'. </p>

<p>So what I need is a list of tuples. Each tuple should have a <code>stringA</code> file and a <code>stringB</code> file in it. There should be one tuple per directory. Each directory is guaranteed to have more than 2 files and is guaranteed to have only one <code>stringA</code> and one <code>stringB</code> file. </p>

<p>What is the most efficient way to do this? Maybe using a list generator?</p>

<p>Edit:</p>

<p>An example:</p>

<pre><code>dirs = ['/dir1', '/dir2', '/dir3']

result = [('/dir1/stringA.txt', '/dir1/stringB.txt'), ('/dir2/stringA.txt', ...) ...]
</code></pre>

<p>The input is directories (a list of directories) and the output should be the result (a list of tuples).</p>
