I have a list of a part of a filename, for each one I want to go through the files in a directory that matches that part and return the filename
<p>So, let's say I have a directory with a bunch of filenames. 
for example:</p>

<p>Scalar Product or Dot Product (Hindi)-fodZTqRhC24.m4a<br>
AP Physics C - Dot Product-Wvhn_lVPiw0.m4a<br>
An Introduction to the Dot Product-X5DifJW0zek.m4a   </p>

<p>Now let's say I have a list, of only the keys, which are at the end of the file names:</p>

<p><code>['fodZTqRhC24', 'Wvhn_lVPiw0, 'X5DifJW0zek']</code></p>

<p>How can I iterate through my list to go into that directory and search for a file name containing that key, and then return me the filename? </p>

<p>Any help is greatly appreciated!</p>

<p>Thanks a lot guys, Once I thought about it, I think I was making it harder than I had to with regex. Sorry about not trying it first. Thank you all once again. I think I have it.   </p>

<pre><code>audio = ['Scalar Product or Dot Product (Hindi)-fodZTqRhC24.m4a',
'An Introduction to the Dot Product-X5DifJW0zek.m4a',
'AP Physics C - Dot Product-Wvhn_lVPiw0.m4a']   

keys = ['fodZTqRhC24', 'Wvhn_lVPiw0', 'X5DifJW0zek']   

file_names = []
for Id in keys:
    for name in audio:
        if Id in name:
            file_names.append(name)

combined = zip(keys,file_names)
combined            
</code></pre>

python