I have a very large file(5 MB) and I need to add few lines just before the last line. e.g.
file.txt
text-1
text-2
text-3
text-10
After adding few lines just before the last line. file.txt
text-1
text-2
text-3
few-text-1
few-text-2
text-10
What are best ways to do it in python.