約 5000 個の文字列置換を実行したい 100 MB の大きなファイルがあります。これを実現する最も効率的な方法は何ですか?
ファイルを 1 行ずつ読み取り、各行で 5000 個の置換を実行するよりも良い方法はありませんか?
また、ファイルを開いて文字列に対して 5000 個の置換を実行するときに .read メソッドを使用してファイルを文字列として読み取ろうとしましたが、ファイル全体のコピーが 5000 個作成されるため、これはさらに遅くなります。
このスクリプトは、Python 2.6 を使用して Windows で実行する必要があります。
前もって感謝します