I have a list of strings and if the string in my list appears in the filename then I want python to open the file. The catch is, I want python to open the files in the order the string appears in my list. My current code opens the files in the order python wants and only checks if the string in the list appears in the filename.
files
dogs.html
cats.html
fish.html
python
list = ['fi', 'do', 'ca']
for name in glob.glob('*.html'):
for item in list:
if item in name:
with open(name) as k:
or create a list of all files first, and then filter that list with every iteration of
list: