Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > I have some SVG files generated with Inkscape containing many text > blocks (over 100). I wish to programmatically modify those text blocks > using Python. Is there a library I should be using, or any other > guidelines or advice anyone can give me?
My first step would be to use ‘lxml’ to manipulate an XML tree, since that's what an SVG document contains. Read the SVG file as a text string, de-serialise the text to an XML tree. Match the nodes of interest using an XPath query, iterate over them. Change the content of each node using Python text manipulation, set the new value on the node. Re-serialise the tree to the SVG file. -- \ “I distrust those people who know so well what God wants them | `\ to do to their fellows, because it always coincides with their | _o__) own desires.” —Susan Brownell Anthony, 1896 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list