First I'll show my code and then I'll explain:
for eachfile in matches:
if eachfile in set1:
print 'find one match'
shutil.copy2(eachfile, '/Users/r2-d2/Desktop/folder')
print 'copy done'
matches is a list like this:
[fooFILE_Aspam.txt, barFILE_B.CSV, codeFILE_Cdog.vcf]
set1 is a set like which looks like this:
(FILE_A, FILE_B, FILE_F...)
I'm iterating over the list to check if inside each entry there's any of the elements of the set. If it does I copy the entry away.
In the above example scenario I expect a match for FILE_A and FILE_B.
I know that the keyword in would work the other way around but I can't find an elegant solution without using another loop.