r/learnpython•
HolyCoder

Python Parser

I have the following code

<tag1 value = "testme">
<tag2 name = "codeme">
</tag2>
<tag1>

Please note that the tags are nested. How do I code such that tag1.value gives the value *"testme" and tag1.tag2.name gives the value "codeme" ? This code should work for any number of line with multiple tags and nested tags.

Posted Aug 17, 2017, 7:42 PM UTC

38
Loading comments…