Search and replace text in XML file?

MRAB python at mrabarnett.plus.com
Sat Jul 28 12:01:19 EDT 2012


On 28/07/2012 09:29, Mark Lawrence wrote:
> On 28/07/2012 08:17, Terry Reedy wrote:
>> On 7/27/2012 9:23 PM, todd.tabern at gmail.com wrote:
>>> I'm looking to search an entire XML file for specific text and
>>> replace that text, while maintaining the structure of the XML file.
>>
>> For a one-off project, or for experimentation, I would use a proper
>> text-editor* and run through with search/replace. For automation, use
>> Jason's suggestion of .replace, perhaps on a line-by-line basis.
>>
>> * By definition, such only make changes you request. Notepad++ is one
>> such on Windows. You do not want a word or document processor, or, for
>> simple xml oblivious text substitutions, an xml processor. Such things
>> often make changes of various sorts.
>>
>
> I highly recommend the use of notepad++.  If anyone knows of a better
> text editor for Windows please let me know :)
>
My own preference is EditPad. I liked EditPad Lite so much that I
bought EditPad Pro.



More information about the Python-list mailing list