I am using Python and need to find and retrieve all character data between tags:
I need this stuff
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 = """ I need this stuff
... blah blah
... I need this stuff too
...
... blah blah """
>>> for item in myhtml.split(""):
... if "" in item:
... print item [ item.find("")+len("") : ]
...
I need this stuff
I need this stuff too