I use LXML batch processing a lot of XML file, use the xpath method to take out the need to use XML2Dict node after the tag name and text to the dictionary, but found that some text value without the label (tag is similar to the index value) is with the label on the back of the, for example, Sam's actual value is red, but the real value of a car is Not zero is Not configure, this how to deal with as a tag and the actual value corresponding to the dictionary, need to output is
{' Sam ':' red ', 'car' : 'Not configure', 'bus' :' string ', 'pop' : 'True', 'Jam' : 'blue'}
CodePudding user response:
Is there a big help to see ahCodePudding user response:
Can use the comment () take out all the comments, but I don't know how to correspond