私の python スクリプトは、ファイル内の各行を読み取り、各行で多くの正規表現の置換を行います。
正規表現が成功した場合は、次の行にスキップします
この種のスクリプトを高速化する方法はありますか?
代わりに subn を呼び出し、置換が完了したかどうかを確認してから、残りのものにスキップする価値はありますか?
正規表現をコンパイルすると、コンパイルされたすべての正規表現をメモリに保存できますか?
for file in files:
for line in file:
re.sub() # <--- ~ 100 re.sub
PS: 各正規表現の代替 vaires