文字列のリスト内の各要素からサブ文字列を削除しようとしています。削除したい複数の部分文字列(ストップワード)を持つ文字列の場合の処理方法を理解するのに問題があります。
wines = ("2008 Chardonnay", "Cabernet Sauvignon 2009", "Bordeaux 2005 Cotes du Rhone")
stop_words = ("2005", "2008", "2009", "Cotes du Rhone")
result = []
for wine in wines:
for stop in stop_words:
if stop in wine:
x = wine.replace(stop, "")
result.append(x)
print result
ifステートメントをforまたはwhileに変更すると、ガベージが返されるか、ハングします。何かアドバイス?