I have a list of keyword to find from a list of file name. Example, if the keyword is 'U12'
, I want to find the csv file that contain 'U12'
which is 'h_ABC_U12.csv'
and print it out.
word = ['U12','U13','U14']
file_list = ['h_ABC_U12.csv','h_GGG_U13.csv','h_HVD_U14.csv','h_MMMB_U15.csv']
for x in range (len(word)):
if word[x] in file_list:
#print the file name
This is part of the code but unable to continue after some searches. I need the full name that match the word to print out.