次のコードがあります。
if inputFileName:
if inputFileName.lower().endswith(mediaExt):
for word in ignoreWords:
if word not in inputFileName.lower():
if os.path.isfile(inputDirectory):
try:
processFile(fileAction, inputDirectory, outputDestination)
except Exception, e:
logging.error(loggerHeader + "There was an error when trying to process file: %s", os.path.join(inputDirectory, inputFileName))
logging.exception(e)
else:
try:
processFile(fileAction, os.path.join(inputDirectory, inputFileName), outputDestination)
except Exception, e:
logging.error(loggerHeader + "There was an error when trying to process file: %s", os.path.join(inputDirectory, inputFileName))
logging.exception(e)
ignoreWords は、ファイル名に含めたくないいくつかの単語を含むリストです。今私の問題は、これがリスト内の x 項目に対して同じファイルをループすることです。単語を1回だけ一致させたい(または、一致が完了したらprocessFileを1回実行する)が、適切な解決策を見つけることができません