I always do append my new lines just before the pattern </IfModule>.
How can i accomplish this with Python.
Just FYI, my file is not an XML/HTML to use lxml/element tree. IfModule is a part of my .htaccess file
My idea is to reverse the file and search for the pattern , if found append my line just after it. Not so sure how to proceed with.
 
     
     
    