[Solved] multiple search and replace in python


import os
parent_folder_path="somepath/parent_folder"
for eachFile in os.listdir(parent_folder_path):
    if eachFile.endswith('.xml'):
       newfilePath = parent_folder_path+"https://stackoverflow.com/"+eachFile
       file = open(newfilePath, 'r')
       xml = file.read()
       file.close()
       xml = xml.replace('thing to replace', 'with content')
       file = open(newfilePath, 'w')
       file.write(str(xml))
       file.close()

Hope this is what you are looking for.

3

solved multiple search and replace in python