I have a list of items and I want to call only those csv files from the directory whose names are similar to the items in the list. I am doing something like below but its reading all the files from the directory. Please suggest.
x_list = [ a,b,c,d]
files in directory = [a.csv, b.csv, c.csv, d.csv, e.csv, f.csv]
for files in os.listdir(dir + 'folder\\'):
    file_name = files[:files.find('.')]
    if file_name in x_list:
        print(file_name) 
 
     
     
    