I want to replace an empty node in xml with python

57 views Asked by At

I want to replace the closing <category/> to Passenger cars </category> with python. I just need to add "Passenger cars" between the category opening and closing xml tags

        categories=xml.getElementsByTagName('category')[0].toxml()
        if categories=='<category/>':
            categories=categories.replace('<category/>','<category>Passenger cars</category>')
0

There are 0 answers