I am using Python and need to find and retrieve all character data between tags:
<tag>I need this stuff</tag>
I then want to output the found data to another file. I am just looking for a very easy and efficient way to do this.
If you can post a quick code snippet to portray the ease of use. Because I am having a bit of trouble understanding the parsers.
without external modules, eg
>>> myhtml = """ <tag>I need this stuff</tag>
... blah blah
... <tag>I need this stuff too
... </tag>
... blah blah """
>>> for item in myhtml.split("</tag>"):
... if "<tag>" in item:
... print item [ item.find("<tag>")+len("<tag>") : ]
...
I need this stuff
I need this stuff too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With