HF RL Explorer

Task: Fix File Search and Replace in Python

Task: Fix File Search and Replace in Python: a task in Terminal-Lego-15k (Harbor dataset). You need to write a Python 3 script that correctly performs search and replace operations on a text file. A common bug occurs when the replacement text is shorter than the original text - leftover characters…

The task

You need to write a Python 3 script that correctly performs search and replace operations on a text file. A common bug occurs when the replacement text is shorter than the original text - leftover characters remain at the end of the file. Your task is to implement a robust solution that handles all cases correctly.

Part of PrimeIntellect/Terminal-Lego-15k.