- 67 名前:デフォルトの名無しさん mailto:sage [2011/11/30(水) 23:34:55.18 ]
- 質問です。
以下のスクリプトを実行してリストから拡張子がmp3のファイルのみ削除したいのですが、実行結果に'test1.mp3'が残ってしまいます。分かる方がいたら教えてください。 環境はWindows xp sp3, python ver 2.7.1 です。 l = ['test0.mp3', 'test1.mp3', 'test2.mp3', 'test3.wma'] for i in l: if i.endswith(".mp3"): l.remove(i) print l >>>['test1.mp3', 'test3.wma']
|

|