I have big file (few GBs) with text.
For example, it have next text:
Hello, World!
I need to insert word " funny" at 5 position, and offset the rest of text:
Hello, funny World!
How I can don't read all file for offsetting rest? Or how I can optimise this operation?
Thanks.
You can't. Plain text files cannot be shrunk or expanded in the beginning or middle of the file, but only at the end.
Well you cant, please see this for more info How do I modify a text file in Python?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With