I merge exp files into xlsx file. As an output, I get many xlsx files and I need to name them accordingly to the names of exp files.
I would like to be able to choose the specific word which occurs in the exp file name, select this specific word and add it to the name of the output xlsx file.
choice = ['A', 'B', 'C', 'D']
matches = []
for match in choice:
if ('A' in match or 'B' in match):
matches.append(match)
nk = match
assemble("sample" + str(nk) + ".xlsx")
I could include the 'B' in the xlsx name with the code below. But my goal is to add 'B' to the name of xlsx file only if I used the exp file with the name 'B' to create the xlsx file.